From 72ee74900c7683be287a4530cc70bfbd70e5ce9b Mon Sep 17 00:00:00 2001 From: Christian Henning Date: Fri, 5 Jan 2018 10:11:01 -0500 Subject: [PATCH] #31 if stream is bad then throw --- include/boost/gil/extension/io/detail/io_device.hpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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() {