From a277b9693bec8868c7ae993abdfb761d4c9d01b2 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Fri, 2 Jul 2021 18:34:04 +0200 Subject: [PATCH] Fixed an issue where missing theme font files would crash the application. --- es-core/src/resources/Font.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/es-core/src/resources/Font.cpp b/es-core/src/resources/Font.cpp index 6b1ed1a73..196f9ce23 100644 --- a/es-core/src/resources/Font.cpp +++ b/es-core/src/resources/Font.cpp @@ -724,5 +724,11 @@ std::shared_ptr Font::getFromTheme(const ThemeData::ThemeElement* elem, if (properties & FONT_PATH && elem->has("fontPath")) path = elem->get("fontPath"); + if (!Utils::FileSystem::exists(path)) { + LOG(LogError) << "Font file \"" << path << "\" defined by the theme does not exist, " + "falling back to \"" << getDefaultPath() << "\""; + path = getDefaultPath(); + } + return get(size, path); }