Fixed an issue where missing theme font files would crash the application.

This commit is contained in:
Leon Styhre 2021-07-02 18:34:04 +02:00
parent 064e8f81d0
commit a277b9693b

View file

@ -724,5 +724,11 @@ std::shared_ptr<Font> Font::getFromTheme(const ThemeData::ThemeElement* elem,
if (properties & FONT_PATH && elem->has("fontPath"))
path = elem->get<std::string>("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);
}