Throw if open file with EXV_ENABLE_FILESYSTEM off

If ImageFactory::createIo() is called with a file path and has been
built with EXV_ENABLE_FILESYSTEM off it returns a NULL pointer.
ImageFactory::open() then calls io->open() on this pointer, causing a
segfault. The documentation of ImageFactory::createIo does not say it
can return a NULL pointer. This commit makes it throw an exception
instead of returning a NULL pointer.

(cherry picked from commit b0f1c48b180420837dd0663b9ac689c21bd168d0)
main
Jim Easterbrook 11 months ago committed by Miloš Komarčević
parent 273873048f
commit 069de70654

@ -831,7 +831,7 @@ BasicIo::UniquePtr ImageFactory::createIo(const std::string& path, [[maybe_unuse
return std::make_unique<FileIo>(path);
#else
return nullptr;
throw Error(ErrorCode::kerFileOpenFailed, path, "", "file access disabled");
#endif
} // ImageFactory::createIo

Loading…
Cancel
Save