1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-17 09:22:42 +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

@@ -444,7 +444,7 @@ void Textbuf::Assign(const std::string_view text)
*/
void Textbuf::UpdateSize()
{
this->chars = static_cast<uint16_t>(Utf8StringLength(this->buf.data()) + 1); // terminating zero
this->chars = static_cast<uint16_t>(Utf8StringLength(this->buf.c_str()) + 1); // terminating zero
assert(this->buf.size() < this->max_bytes);
assert(this->chars <= this->max_chars);