mirror of
https://github.com/libretro/ppsspp.git
synced 2025-03-01 13:16:37 +00:00
virtfs: Avoid crash if handler cannot be loaded.
For example, if it was renamed or is for the wrong OS.
This commit is contained in:
parent
ad01fee44a
commit
25c320aa4b
@ -112,13 +112,16 @@ void VirtualDiscFileSystem::LoadFileListIndex() {
|
||||
size_t handler_pos = line.find(':', filename_pos);
|
||||
if (handler_pos != line.npos) {
|
||||
entry.fileName = line.substr(filename_pos, handler_pos - filename_pos);
|
||||
|
||||
std::string handler = line.substr(handler_pos + 1);
|
||||
size_t trunc = handler.find_last_not_of("\r\n");
|
||||
if (trunc != handler.npos && trunc != handler.size())
|
||||
handler.resize(trunc + 1);
|
||||
|
||||
if (handlers.find(handler) == handlers.end())
|
||||
handlers[handler] = new Handler(handler.c_str(), this);
|
||||
entry.handler = handlers[handler];
|
||||
if (handlers[handler]->IsValid())
|
||||
entry.handler = handlers[handler];
|
||||
} else {
|
||||
entry.fileName = line.substr(filename_pos);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user