From fd204874ec894297ccd9f6c04309e12992431688 Mon Sep 17 00:00:00 2001 From: Artem Pavlenko Date: Thu, 15 Apr 2021 15:53:04 +0100 Subject: [PATCH] svg2png - avoid writing to an empty image --- utils/svg2png/svg2png.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/svg2png/svg2png.cpp b/utils/svg2png/svg2png.cpp index 8484cf74d..b4cbf6858 100644 --- a/utils/svg2png/svg2png.cpp +++ b/utils/svg2png/svg2png.cpp @@ -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(std::round(svg_width)); - int output_height = static_cast(std::round(svg_height)); + int output_width = std::max(1, static_cast(std::round(svg_width))); + int output_height = std::max(1, static_cast(std::round(svg_height))); if (verbose_) { std::clog << "SVG width of '" << w << "' and height of '" << h << "'\n";