summaryrefslogtreecommitdiff
path: root/src/pal/src/cruntime/wchar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/pal/src/cruntime/wchar.cpp')
-rw-r--r--src/pal/src/cruntime/wchar.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/pal/src/cruntime/wchar.cpp b/src/pal/src/cruntime/wchar.cpp
index 3de065e361..5b466960a6 100644
--- a/src/pal/src/cruntime/wchar.cpp
+++ b/src/pal/src/cruntime/wchar.cpp
@@ -1194,16 +1194,22 @@ PAL_wcsstr(
i = 0;
while (1)
{
- if (*(string + i) == 0 || *(strCharSet + i) == 0)
+ if (*(strCharSet + i) == 0)
{
ret = (wchar_16 *) string;
goto leave;
}
- if (*(string + i) != *(strCharSet + i))
+ else if (*(string + i) == 0)
+ {
+ ret = NULL;
+ goto leave;
+ }
+ else if (*(string + i) != *(strCharSet + i))
{
break;
}
- i++;
+
+ i++;
}
string++;
}