diff --git a/src/Plugins/TgaImporter/TgaImporter.cpp b/src/Plugins/TgaImporter/TgaImporter.cpp index 71416541c..25b74a7b4 100644 --- a/src/Plugins/TgaImporter/TgaImporter.cpp +++ b/src/Plugins/TgaImporter/TgaImporter.cpp @@ -31,6 +31,10 @@ static_assert(sizeof(TgaImporter::Header) == 18, "TgaImporter: header size is no bool TgaImporter::TgaImporter::open(const string& filename) { ifstream in(filename.c_str()); + if(!in.good()) { + Error() << "TgaImporter: cannot open file" << filename; + return false; + } bool status = open(in); in.close(); return status; @@ -38,7 +42,10 @@ bool TgaImporter::TgaImporter::open(const string& filename) { bool TgaImporter::open(std::istream& in) { if(_image) close(); - if(!in.good()) return false; + if(!in.good()) { + Error() << "TgaImporter: cannot read input stream"; + return false; + } Header header; in.read(reinterpret_cast(&header), sizeof(Header));