[Scummvm-git-logs] scummvm master -> c86355d59299532ca08ce9c97048a9ae5647ee35

criezy criezy at scummvm.org
Tue Feb 16 03:12:36 UTC 2021


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
c86355d592 AGS: Fix assert when trying to open file that does not exist


Commit: c86355d59299532ca08ce9c97048a9ae5647ee35
    https://github.com/scummvm/scummvm/commit/c86355d59299532ca08ce9c97048a9ae5647ee35
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2021-02-16T03:12:08Z

Commit Message:
AGS: Fix assert when trying to open file that does not exist

Changed paths:
    engines/ags/shared/util/stdio_compat.cpp


diff --git a/engines/ags/shared/util/stdio_compat.cpp b/engines/ags/shared/util/stdio_compat.cpp
index 4ec29b290b..f6b75a497a 100644
--- a/engines/ags/shared/util/stdio_compat.cpp
+++ b/engines/ags/shared/util/stdio_compat.cpp
@@ -84,11 +84,15 @@ Common::FSNode getFSNode(const char *path) {
 			return dir->getFSNode().getChild(file->getName());
 	}
 
-	dir.reset(dir->getSubDirectory(filePath));
-	if (dir)
+	Common::FSDirectory *subDir = dir->getSubDirectory(filePath);
+	if (subDir) {
+		dir.reset(subDir);
 		return dir->getFSNode();
+	}
 
-	return Common::FSNode();
+	// The files does not exist, but create the FSNode anyway so that
+	// the code using this can report the correct error rather than assert.
+	return dir->getFSNode().getChild(filePath);
 }
 
 int  ags_file_exists(const char *path) {




More information about the Scummvm-git-logs mailing list