mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-26 14:19:51 +00:00
Fix crash if string_to_color is passed an empty string
This commit is contained in:
parent
e338869b01
commit
4927e71ed1
@ -66,7 +66,7 @@ color_t string_to_color(const std::string &cmp_str)
|
||||
return font::BLUE_COLOR;
|
||||
}
|
||||
|
||||
if (cmp_str.at(0) == '#' && cmp_str.size() == 7) {
|
||||
if (cmp_str.size() == 7 && cmp_str.at(0) == '#') {
|
||||
// #rrggbb color, pango format.
|
||||
return color_t::from_hex_string(cmp_str.substr(1));
|
||||
} else if (cmp_str.size() == 6) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user