Added handling of error condition

This commit is contained in:
Robert Osfield
2016-06-30 11:31:02 +01:00
parent 9e7d361a50
commit b3765ac3cf

View File

@@ -121,7 +121,12 @@ bool HDRLoader::load(const char *_fileName, const bool _rawRGBE, HDRLoaderResult
if (memcmp(str, "#?RADIANCE", 10))
{
fseek(file, 0, SEEK_SET);
if (fseek(file, 0, SEEK_SET)!=0)
{
fclose(file);
return false;
}
numRead = fread(str, 6, 1, file);
if (numRead<1 || memcmp(str, "#?RGBE", 6))
{
@@ -129,7 +134,11 @@ bool HDRLoader::load(const char *_fileName, const bool _rawRGBE, HDRLoaderResult
return false;
}
}
fseek(file, 1, SEEK_CUR);
if (fseek(file, 1, SEEK_CUR)!=0)
{
fclose(file);
return false;
}
//char cmd[2000];
i = 0;