From 28206248d44991654acfa0e9a0bb22de8e90783b Mon Sep 17 00:00:00 2001 From: David Ludwig Date: Tue, 7 Nov 2017 17:57:10 -0500 Subject: [PATCH] bug-fix: crash on startup, when passing in single-parameter, command-line args --- BasiliskII/src/Unix/main_unix.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/BasiliskII/src/Unix/main_unix.cpp b/BasiliskII/src/Unix/main_unix.cpp index c80f95f4..59444580 100644 --- a/BasiliskII/src/Unix/main_unix.cpp +++ b/BasiliskII/src/Unix/main_unix.cpp @@ -432,12 +432,14 @@ int main(int argc, char **argv) #if defined(__APPLE__) && defined(__MACH__) // Mac OS X likes to pass in various options of its own, when launching an app. // Attempt to ignore these. - const char * mac_psn_prefix = "-psn_"; - if (strcmp(argv[i], "-NSDocumentRevisionsDebugMode") == 0) { - argv[i] = NULL; - } else if (strncmp(mac_psn_prefix, argv[i], strlen(mac_psn_prefix)) == 0) { - argv[i] = NULL; - } + if (argv[i]) { + const char * mac_psn_prefix = "-psn_"; + if (strcmp(argv[i], "-NSDocumentRevisionsDebugMode") == 0) { + argv[i] = NULL; + } else if (strncmp(mac_psn_prefix, argv[i], strlen(mac_psn_prefix)) == 0) { + argv[i] = NULL; + } + } #endif }