mirror of
https://github.com/yuzu-emu/FasTC
synced 2024-11-26 01:18:03 +00:00
Don't crash if we can't parse the filename
This commit is contained in:
parent
aa7e73c4b3
commit
754cd3532a
1 changed files with 5 additions and 0 deletions
|
@ -100,6 +100,11 @@ void ExtractBasename(const char *filename, char *buf, size_t bufSz) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!base) {
|
||||||
|
fprintf(stderr, "Filename (%s) has no extension, we don't know how to deal with it!\n", filename);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
size_t numChars = ext - base + 1;
|
size_t numChars = ext - base + 1;
|
||||||
size_t toCopy = ::std::min(numChars, bufSz);
|
size_t toCopy = ::std::min(numChars, bufSz);
|
||||||
memcpy(buf, base, toCopy);
|
memcpy(buf, base, toCopy);
|
||||||
|
|
Loading…
Reference in a new issue