only encode if image has dimensions (avoid abort in png writer on zero size width or height)

This commit is contained in:
Dane Springmeyer 2012-02-10 12:14:53 -08:00
parent a682212266
commit bfd79276a7

View file

@ -248,7 +248,7 @@ void save_to_stream(T const& image,
std::string const& type,
rgba_palette const& palette)
{
if (stream)
if (stream && image.width() > 0 && image.height() > 0)
{
//all this should go into image_writer factory
std::string t = boost::algorithm::to_lower_copy(type);
@ -299,7 +299,7 @@ void save_to_stream(T const& image,
std::ostream & stream,
std::string const& type)
{
if (stream)
if (stream && image.width() > 0 && image.height() > 0)
{
//all this should go into image_writer factory
std::string t = boost::algorithm::to_lower_copy(type);