partially fix segfault when run with options but no input file

(caused by fclose()-ing an unopened file)
This commit is contained in:
anthony
2009-12-30 00:08:25 -07:00
parent 5e9c2ee2ab
commit e5ac9c2cd8

View File

@@ -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);
} }