mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-21 02:32:06 +00:00
partially fix segfault when run with options but no input file
(caused by fclose()-ing an unopened file)
This commit is contained in:
@@ -167,8 +167,7 @@ int main(int argc, char *argv[])
|
|||||||
strcat(filename, ".gb");
|
strcat(filename, ".gb");
|
||||||
|
|
||||||
f = fopen(filename, "rb+");
|
f = fopen(filename, "rb+");
|
||||||
if (!f)
|
if( (f=fopen(filename,"rb+"))!=NULL ) {
|
||||||
FatalError("Unable to open file");
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* -d (Debug) option code
|
* -d (Debug) option code
|
||||||
@@ -464,6 +463,9 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
} else {
|
||||||
|
FatalError("File '%s' not found",filename);
|
||||||
|
}
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user