diff --git a/include/boost/gil/extension/io/detail/io_device.hpp b/include/boost/gil/extension/io/detail/io_device.hpp index e8cf4e9a0..885afb946 100644 --- a/include/boost/gil/extension/io/detail/io_device.hpp +++ b/include/boost/gil/extension/io/detail/io_device.hpp @@ -354,7 +354,14 @@ class istream_device { public: istream_device( std::istream& in ) - : _in( in ) {} + : _in( in ) + { + if (!in) + { + // does the file exists? + io_error("Stream is not valid."); + } + } int getc_unchecked() {