From 096e5cf33c87dc558c3d5c604c2425d9751e3e8d Mon Sep 17 00:00:00 2001 From: Marco Lizza Date: Wed, 4 Feb 2015 13:53:59 +0100 Subject: [PATCH] Fixing empty search string corner case. --- src/wren_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wren_core.c b/src/wren_core.c index 76373e8b..9fa118cc 100644 --- a/src/wren_core.c +++ b/src/wren_core.c @@ -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); }