[Scummvm-git-logs] scummvm branch-2-7 -> 2f8b8920fafbc7a122cb97e53e3d0f13ab4d88d2

phcoder noreply at scummvm.org
Wed Feb 1 22:54:27 UTC 2023


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:
2f8b8920fa BASE: Fix NPE when executable name is not available


Commit: 2f8b8920fafbc7a122cb97e53e3d0f13ab4d88d2
    https://github.com/scummvm/scummvm/commit/2f8b8920fafbc7a122cb97e53e3d0f13ab4d88d2
Author: Vladimir Serbinenko (phcoder at gmail.com)
Date: 2023-02-01T23:12:26+01:00

Commit Message:
BASE: Fix NPE when executable name is not available

Changed paths:
    base/main.cpp


diff --git a/base/main.cpp b/base/main.cpp
index ff90e557425..3700cd0babe 100644
--- a/base/main.cpp
+++ b/base/main.cpp
@@ -418,7 +418,7 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) {
 	bool autodetect = false;
 
 	// Check for the autorun name
-	if (argv[0]) {
+	if (argc && argv && argv[0]) {
 		const char *s = strrchr(argv[0], '/');
 
 		if (!s)
@@ -444,7 +444,7 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) {
 		Common::String line;
 		Common::String res;
 
-		autorunArgs.push_back(argv[0]);
+		autorunArgs.push_back(argc && argv ? argv[0] : "");
 
 		if (autorun.open("scummvm-autorun")) {
 			while (!autorun.eos()) {




More information about the Scummvm-git-logs mailing list