From 2507ee5ca4c453fa3f2f70f39a8681cafb25c448 Mon Sep 17 00:00:00 2001 From: oOjor-elOo <105416199+oOjor-elOo@users.noreply.github.com> Date: Mon, 12 Dec 2022 14:08:55 +0100 Subject: [PATCH] Windows: Validate that the font family name exists before trying to get the font family I didn't have the first emoji font installed, which led an an exception when calling font_collection->GetFontFamily() no the new rows. --- platform/windows/os_windows.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 34afc4ea144e..a083a98c727a 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -1059,7 +1059,7 @@ String OS_Windows::get_system_font_path(const String &p_font_name, int p_weight, UINT32 index = 0; BOOL exists = false; HRESULT hr = font_collection->FindFamilyName((const WCHAR *)font_name.utf16().get_data(), &index, &exists); - if (FAILED(hr)) { + if (FAILED(hr) || !exists) { return String(); }