diff --git a/dlib/image_loader/png_loader.cpp b/dlib/image_loader/png_loader.cpp index 490318d42..b85120f10 100644 --- a/dlib/image_loader/png_loader.cpp +++ b/dlib/image_loader/png_loader.cpp @@ -46,6 +46,10 @@ namespace dlib { } + // no copying this object. + FileInfo(const FileInfo&) = delete; + FileInfo& operator=(const FileInfo&) = delete; + ~FileInfo() { if ( fp_ != nullptr ) fclose( fp_ ); @@ -174,7 +178,7 @@ namespace dlib void png_loader::read_image( std::unique_ptr file_info ) { - if ( !file_info ) throw image_load_error(std::string("png_loader: invalid file_info, it is NULL")); + DLIB_CASSERT(file_info); ld_.reset(new LibpngData);