1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-22 11:44:17 +01:00

Codefix: std::string_view::data() is not necessarily null terminated. (#13891)

This commit is contained in:
frosch
2025-03-25 20:32:19 +01:00
committed by GitHub
parent 93016b9a92
commit 25005cff16
7 changed files with 10 additions and 9 deletions

View File

@@ -297,7 +297,7 @@ static ChangeInfoResult GlobalVarChangeInfo(uint first, uint last, int prop, Byt
* such as Cyrillic. Thus we will simply assume they're all UTF8. */
char32_t c;
size_t len = Utf8Decode(&c, name.data());
if (c == NFO_UTF8_IDENTIFIER) name = name.substr(len);
if (len <= name.size() && c == NFO_UTF8_IDENTIFIER) name = name.substr(len);
LanguageMap::Mapping map;
map.newgrf_id = newgrf_id;