mirror of
https://github.com/openmoh/openmohaa.git
synced 2025-04-28 21:57:57 +03:00
Fixed length decrease with an higher value
This commit is contained in:
parent
f9ef6733b9
commit
4939927975
1 changed files with 3 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue