From 755a86f5025e9166e3c5b140d0bf5650166f0db1 Mon Sep 17 00:00:00 2001 From: Yuri Sizov Date: Tue, 7 Mar 2023 15:31:19 +0100 Subject: Generate empty textures for theme icons if the SVG module is disabled (cherry picked from commit 64215ad1192878b72e784c5a62ea9b2dba0520dd) --- scene/resources/default_theme/default_theme.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'scene') diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp index cc606b5b88..2e1ba96d11 100644 --- a/scene/resources/default_theme/default_theme.cpp +++ b/scene/resources/default_theme/default_theme.cpp @@ -86,6 +86,10 @@ static Ref generate_icon(int p_index) { ImageLoaderSVG img_loader; Error err = img_loader.create_image_from_string(img, default_theme_icons_sources[p_index], scale, upsample, HashMap()); ERR_FAIL_COND_V_MSG(err != OK, Ref(), "Failed generating icon, unsupported or invalid SVG data in default theme."); +#else + // If the SVG module is disabled, we can't really display the UI well, but at least we won't crash. + // 16 pixels is used as it's the most common base size for Godot icons. + img = Image::create_empty(16 * scale, 16 * scale, false, Image::FORMAT_RGBA8); #endif return ImageTexture::create_from_image(img); -- cgit v1.2.3