diff --git a/src/object.c b/src/object.c index ad4b36ba1a..12a01acece 100644 --- a/src/object.c +++ b/src/object.c @@ -92,6 +92,10 @@ int object_load_file(int groupIndex, const rct_object_entry *entry, int* chunkSi *chunkSize = sawyercoding_read_chunk(rw, chunk); } SDL_RWclose(rw); + if (chunk == NULL) { + log_error("Failed to load object from %s of size %d", path, *chunkSize); + return 0; + } int calculatedChecksum = object_calculate_checksum(&openedEntry, chunk, *chunkSize); diff --git a/src/scenario_list.c b/src/scenario_list.c index 9e10f635d6..8284723fcf 100644 --- a/src/scenario_list.c +++ b/src/scenario_list.c @@ -432,6 +432,9 @@ static bool scenario_scores_load() SDL_RWread(file, &highscore->timestamp, sizeof(highscore->timestamp), 1); // Attach highscore to correct scenario entry + if (highscore->fileName == NULL) { + continue; + } scenario_index_entry *scenarioIndexEntry = scenario_list_find_by_filename(highscore->fileName); if (scenarioIndexEntry != NULL) { scenarioIndexEntry->highscore = highscore;