qt: Fix potential null pointer access in media history

This commit is contained in:
cold-brewed
2022-09-12 09:48:14 -04:00
parent d2dc53fbfb
commit e5d6430ec8

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);
}
}
}
}