Handle null file pointer
This commit is contained in:
Valentino Orlandi 2022-10-06 21:28:33 +02:00
parent f3dbfbf3d8
commit 7d02d5abbd
Signed by: elB4RTO
GPG Key ID: 1719E976DB2D4E71
1 changed files with 5 additions and 0 deletions

View File

@ -55,6 +55,11 @@ void GZutils::readFile( const std::string& path, std::string& content )
if ( successful ) {
FILE *file = fopen ( path.c_str(), "rb" );
/*FILE *dest = fopen ( out_path.c_str(), "wb" );*/
if ( file == NULL ) {
// unable to open the file
//throw("cannot read");
return;
}
// decompress until deflate stream ends or end of file is reached
do {
strm.avail_in = fread( in, 1, CHUNK, file );