SLUDGE: Fix potential NULL dereference

This commit is contained in:
Eugene Sandulenko 2021-05-10 11:29:56 +02:00
parent 6dcf0939bf
commit 77bfebb317
No known key found for this signature in database
GPG Key ID: 014D387312D34F08

View File

@ -2385,12 +2385,14 @@ builtIn(_rem_launchWith) {
Common::FSList files;
gameDataDir.getChildren(files, Common::FSNode::kListFilesOnly);
for (Common::FSList::const_iterator file = files.begin(); file != files.end(); ++file) {
Common::String fileName = file->getName();
fileName.toLowercase();
if (fileName.hasSuffix(".dat") || fileName == "data") {
g_sludge->launchNext = file->getName();
return BR_CONTINUE;
if (!files.empty()) {
for (Common::FSList::const_iterator file = files.begin(); file != files.end(); ++file) {
Common::String fileName = file->getName();
fileName.toLowercase();
if (fileName.hasSuffix(".dat") || fileName == "data") {
g_sludge->launchNext = file->getName();
return BR_CONTINUE;
}
}
}
}