mirror of
https://github.com/wren-lang/wren.git
synced 2026-01-11 22:28:45 +01:00
Fixing empty search string corner case.
This commit is contained in:
@ -1156,8 +1156,8 @@ DEF_NATIVE(string_contains)
|
||||
ObjString* string = AS_STRING(args[0]);
|
||||
ObjString* search = AS_STRING(args[1]);
|
||||
|
||||
// Corner case, the empty string contains the empty string.
|
||||
if (string->length == 0 && search->length == 0) RETURN_TRUE;
|
||||
// Corner case, the empty string is always contained.
|
||||
if (search->length == 0) RETURN_TRUE;
|
||||
|
||||
RETURN_BOOL(wrenStringFind(vm, string, search) != string->length);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user