Skip to content

Commit b132306

Browse files
committed
Bios not launched anymore if no args or arg is only -cdfile
1 parent 987c2fb commit b132306

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

frontend/main.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -715,19 +715,30 @@ int main(int argc, char *argv[])
715715

716716
emu_core_preinit();
717717

718+
if (argc <= 1){
719+
printf("Not enough args specified, exit\n");
720+
exit(EXIT_FAILURE);
721+
};
722+
718723
// read command line options
719724
for (i = 1; i < argc; i++) {
720725
if (!strcmp(argv[i], "-psxout")) psxout = 1;
721726
else if (!strcmp(argv[i], "-load")) loadst = atol(argv[++i]);
722727
else if (!strcmp(argv[i], "-cfg")) {
723-
if (i+1 >= argc) break;
728+
if (i+1 >= argc){
729+
printf("Config file not specified, exit\n");
730+
exit(EXIT_FAILURE);
731+
};
724732
strncpy(cfgfile_basename, argv[++i], MAXPATHLEN-100); /* TODO buffer overruns */
725733
SysPrintf("Using config file %s.\n", cfgfile_basename);
726734
}
727735
else if (!strcmp(argv[i], "-cdfile")) {
728736
char isofilename[MAXPATHLEN];
729737

730-
if (i+1 >= argc) break;
738+
if (i+1 >= argc){
739+
printf("cdfile arg present but cd file not specified, exit\n");
740+
exit(EXIT_FAILURE);
741+
};
731742
strncpy(isofilename, argv[++i], MAXPATHLEN);
732743
if (isofilename[0] != '/') {
733744
getcwd(path, MAXPATHLEN);

0 commit comments

Comments
 (0)