Fixed length decrease with an higher value

This commit is contained in:
smallmodel 2023-08-19 23:07:47 +02:00
parent f9ef6733b9
commit 4939927975
No known key found for this signature in database
GPG key ID: A96F163ED4891440

View file

@ -288,8 +288,9 @@ str& str::operator-=(int c)
return *this;
}
m_data->len -= c;
if (m_data->len < 0) {
if (m_data->len >= c) {
m_data->len -= c;
} else {
m_data->len = 0;
}