svg2png - avoid writing to an empty image

This commit is contained in:
Artem Pavlenko 2021-04-15 15:53:04 +01:00
parent 654a3c1f9f
commit fd204874ec

View file

@ -90,8 +90,8 @@ struct main_marker_visitor
double svg_width = w * scale_factor_;
double svg_height = h * scale_factor_;
int output_width = static_cast<int>(std::round(svg_width));
int output_height = static_cast<int>(std::round(svg_height));
int output_width = std::max(1, static_cast<int>(std::round(svg_width)));
int output_height = std::max(1, static_cast<int>(std::round(svg_height)));
if (verbose_)
{
std::clog << "SVG width of '" << w << "' and height of '" << h << "'\n";