fontengine: Fix crash loading PNG/XML fonts from paths without dot

fixes #11096
This commit is contained in:
sfan5 2021-06-01 19:45:45 +02:00
parent c9144ae5e2
commit e15cae9fa0

@ -342,8 +342,9 @@ gui::IGUIFont *FontEngine::initSimpleFont(const FontSpec &spec)
(spec.mode == FM_SimpleMono) ? "mono_font_path" : "font_path"); (spec.mode == FM_SimpleMono) ? "mono_font_path" : "font_path");
size_t pos_dot = font_path.find_last_of('.'); size_t pos_dot = font_path.find_last_of('.');
std::string basename = font_path; std::string basename = font_path, ending;
std::string ending = lowercase(font_path.substr(pos_dot)); if (pos_dot != std::string::npos)
ending = lowercase(font_path.substr(pos_dot));
if (ending == ".ttf") { if (ending == ".ttf") {
errorstream << "FontEngine: Found font \"" << font_path errorstream << "FontEngine: Found font \"" << font_path