mirror of https://github.com/OpenRCT2/OpenRCT2.git
Merge pull request #3385 from janisozaur/highscores
Don't parse invalid names from highscores fixes #3333
This commit is contained in:
commit
e9f755c947
|
@ -92,6 +92,10 @@ int object_load_file(int groupIndex, const rct_object_entry *entry, int* chunkSi
|
||||||
*chunkSize = sawyercoding_read_chunk(rw, chunk);
|
*chunkSize = sawyercoding_read_chunk(rw, chunk);
|
||||||
}
|
}
|
||||||
SDL_RWclose(rw);
|
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);
|
int calculatedChecksum = object_calculate_checksum(&openedEntry, chunk, *chunkSize);
|
||||||
|
|
||||||
|
|
|
@ -432,6 +432,9 @@ static bool scenario_scores_load()
|
||||||
SDL_RWread(file, &highscore->timestamp, sizeof(highscore->timestamp), 1);
|
SDL_RWread(file, &highscore->timestamp, sizeof(highscore->timestamp), 1);
|
||||||
|
|
||||||
// Attach highscore to correct scenario entry
|
// Attach highscore to correct scenario entry
|
||||||
|
if (highscore->fileName == NULL) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
scenario_index_entry *scenarioIndexEntry = scenario_list_find_by_filename(highscore->fileName);
|
scenario_index_entry *scenarioIndexEntry = scenario_list_find_by_filename(highscore->fileName);
|
||||||
if (scenarioIndexEntry != NULL) {
|
if (scenarioIndexEntry != NULL) {
|
||||||
scenarioIndexEntry->highscore = highscore;
|
scenarioIndexEntry->highscore = highscore;
|
||||||
|
|
Loading…
Reference in New Issue