Changeset - r28513:ea5142b3c09b
[Not reviewed]
master
0 1 0
Peter Nelson - 11 months ago 2024-01-19 08:03:32
peter1138@openttd.org
Fix 09f585b: Crash if font name ends with comma or comma and whitespace on Linux. (#11838)
1 file changed with 2 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/os/unix/font_unix.cpp
Show inline comments
 
@@ -34,6 +34,8 @@ static std::tuple<std::string, std::stri
 
	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)) };
 
}
 

	
0 comments (0 inline, 0 general)