Parcourir la source

Check arg count before attempting to access it.

archshift il y a 12 ans
Parent
commit
62528320ea
1 fichiers modifiés avec 8 ajouts et 1 suppressions
  1. 8 1
      src/citra/citra.cpp

+ 8 - 1
src/citra/citra.cpp

@@ -24,7 +24,14 @@ int __cdecl main(int argc, char **argv) {
 
 
 	System::Init(emu_window);
 	System::Init(emu_window);
 
 
-    std::string boot_filename = argv[1];
+    std::string boot_filename;
+	
+	if (argc < 2) {
+		ERROR_LOG(BOOT, "Failed to load ROM: No ROM specified");
+	}
+	else {
+		boot_filename = argv[1];
+	}
     std::string error_str;
     std::string error_str;
     
     
     bool res = Loader::LoadFile(boot_filename, &error_str);
     bool res = Loader::LoadFile(boot_filename, &error_str);