prevent a 0 size to assert when creating icon from svg
authorMatthieu Gallien <matthieu.gallien@nextcloud.com>
Mon, 13 Feb 2023 14:19:54 +0000 (15:19 +0100)
committerMatthieu Gallien <matthieu.gallien@nextcloud.com>
Wed, 17 May 2023 16:16:08 +0000 (18:16 +0200)
Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
src/gui/iconutils.cpp

index 2f6b6f2ad2d033a9c848dbd6246c07276563d9dc..01a1abbe570a550411aab54d4be25f21c8dcbaea 100644 (file)
@@ -155,7 +155,10 @@ QImage drawSvgWithCustomFillColor(
         return {};
     }
 
-    const auto reqSize = requestedSize.isValid() ? requestedSize : svgRenderer.defaultSize();
+    const auto reqSize = (requestedSize.isValid() && requestedSize.height() && requestedSize.height()) ? requestedSize : svgRenderer.defaultSize();
+    if (!reqSize.isValid() || !reqSize.height() || !reqSize.height()) {
+        return {};
+    }
 
     if (originalSize) {
         *originalSize = svgRenderer.defaultSize();