Skip to content

Commit

Permalink
only encode if image has dimensions (avoid abort in png writer on zer…
Browse files Browse the repository at this point in the history
…o size width or height)
  • Loading branch information
Dane Springmeyer committed Feb 10, 2012
1 parent a682212 commit bfd7927
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/image_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit bfd7927

Please sign in to comment.