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");
|
||||
|
||||
f = fopen(filename, "rb+");
|
||||
if (!f)
|
||||
FatalError("Unable to open file");
|
||||
if( (f=fopen(filename,"rb+"))!=NULL ) {
|
||||
|
||||
/*
|
||||
* -d (Debug) option code
|
||||
@@ -464,6 +463,9 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
} else {
|
||||
FatalError("File '%s' not found",filename);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user