Don't crash when you can't open a file that doesn't exist

This commit is contained in:
Pavel Krajcevski 2014-11-03 15:57:34 -05:00
parent 0c25135555
commit 6f82ab8941
2 changed files with 3 additions and 2 deletions

View file

@ -71,7 +71,6 @@ int main(int argc, char **argv) {
ImageFile imgf (argv[1]); ImageFile imgf (argv[1]);
if(!imgf.Load()) { if(!imgf.Load()) {
fprintf(stderr, "Error loading file: %s\n", argv[1]);
return 1; return 1;
} }

View file

@ -95,7 +95,9 @@ public:
} }
~FileStreamImpl() { ~FileStreamImpl() {
fclose(m_FilePtr); if (0 != m_FilePtr) {
fclose(m_FilePtr);
}
} }
void IncreaseReferenceCount() { m_ReferenceCount++; } void IncreaseReferenceCount() { m_ReferenceCount++; }