Merge pull request #2677 from cold-brewed/media-history-fix

qt: Fix potential null pointer access in media history
This commit is contained in:
David Hrdlička
2022-09-13 21:07:05 +02:00
committed by GitHub

View File

@@ -132,8 +132,9 @@ void MediaHistoryManager::serializeImageHistoryType(ui::MediaType type)
continue;
}
for ( int slot = 0; slot < MAX_PREV_IMAGES; slot++) {
strncpy(device_history_ptr[slot], master_list[type][device][slot].toUtf8().constData(), MAX_IMAGE_PATH_LEN);
if (device_history_ptr[slot] != nullptr) {
strncpy(device_history_ptr[slot], master_list[type][device][slot].toUtf8().constData(), MAX_IMAGE_PATH_LEN);
}
}
}
}