Skip to content

Commit

Permalink
fontengine: Fix crash loading PNG/XML fonts from paths without dot
Browse files Browse the repository at this point in the history
fixes #11096
  • Loading branch information
sfan5 committed Jun 1, 2021
1 parent c9144ae commit e15cae9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/client/fontengine.cpp
Expand Up @@ -342,8 +342,9 @@ gui::IGUIFont *FontEngine::initSimpleFont(const FontSpec &spec)
(spec.mode == FM_SimpleMono) ? "mono_font_path" : "font_path");

size_t pos_dot = font_path.find_last_of('.');
std::string basename = font_path;
std::string ending = lowercase(font_path.substr(pos_dot));
std::string basename = font_path, ending;
if (pos_dot != std::string::npos)
ending = lowercase(font_path.substr(pos_dot));

if (ending == ".ttf") {
errorstream << "FontEngine: Found font \"" << font_path
Expand Down

0 comments on commit e15cae9

Please sign in to comment.