Skip to content

Commit e15cae9

Browse files
committedJun 1, 2021
fontengine: Fix crash loading PNG/XML fonts from paths without dot
fixes #11096
1 parent c9144ae commit e15cae9

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed
 

‎src/client/fontengine.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -342,8 +342,9 @@ gui::IGUIFont *FontEngine::initSimpleFont(const FontSpec &spec)
342342
(spec.mode == FM_SimpleMono) ? "mono_font_path" : "font_path");
343343

344344
size_t pos_dot = font_path.find_last_of('.');
345-
std::string basename = font_path;
346-
std::string ending = lowercase(font_path.substr(pos_dot));
345+
std::string basename = font_path, ending;
346+
if (pos_dot != std::string::npos)
347+
ending = lowercase(font_path.substr(pos_dot));
347348

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

0 commit comments

Comments
 (0)
Please sign in to comment.