fix(string): correctly handle not found case in SStrStr

This commit is contained in:
fallenoak 2020-11-16 17:54:56 -06:00
parent 001edb9a7a
commit 611186db9e
No known key found for this signature in database
GPG key ID: 7628F8E61AEA070D
2 changed files with 19 additions and 1 deletions

View file

@ -234,8 +234,12 @@ const char* SStrStr(const char* string, const char* search) {
return nullptr;
}
while (*substring && SStrCmp(substring, search, length)) {
while (SStrCmp(substring, search, length)) {
substring++;
if (!*substring) {
return nullptr;
}
}
return substring;