1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-17 03:53:07 +01:00

Only copy strings when they're different

When called from window_loadsave_scrollmousedown,
window_loadsave_populate_list will try to strncpy a string over itself.
This commit prevents that.
This commit is contained in:
Michał Janiszewski
2015-10-23 17:22:31 +02:00
parent a24b3e114c
commit 79552feb54

View File

@@ -600,7 +600,9 @@ static void window_loadsave_populate_list(int includeNewItem, bool browsable, co
char *dst, filter[MAX_PATH], subDir[MAX_PATH];
strncpy(_directory, directory, sizeof(_directory));
strncpy(_extension, extension, sizeof(_extension));
if (_extension != extension) {
strncpy(_extension, extension, sizeof(_extension));
}
_shortenedDirectory[0] = '\0';
strncpy(filter, directory, sizeof(filter));