1
0
Fork 0

Fix 09f585b: Crash if font name ends with comma or comma and whitespace on Linux.

pull/11838/head
Peter Nelson 2024-01-19 00:55:32 +00:00
parent ae575a7a5b
commit d15fba439a
No known key found for this signature in database
GPG Key ID: 8EF8F0A467DF75ED
1 changed files with 2 additions and 0 deletions

View File

@ -34,6 +34,8 @@ static std::tuple<std::string, std::string> SplitFontFamilyAndStyle(std::string_
if (separator == std::string_view::npos) return { std::string(font_name), std::string() };
auto begin = font_name.find_first_not_of("\t ", separator + 1);
if (begin == std::string_view::npos) return { std::string(font_name.substr(0, separator)), std::string() };
return { std::string(font_name.substr(0, separator)), std::string(font_name.substr(begin)) };
}