Merge pull request #3385 from janisozaur/highscores

Don't parse invalid names from highscores fixes #3333
This commit is contained in:
Ted John 2016-04-22 21:16:00 +01:00
commit e9f755c947
2 changed files with 7 additions and 0 deletions

View File

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

View File

@ -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;