Resolve #554: STRSUB("<N-char string>", N, 0) will not warn "Position N is past the end of the string"

This commit is contained in:
Rangi
2020-08-31 15:37:19 -04:00
parent e05321356b
commit b65b723fa6

View File

@@ -461,7 +461,7 @@ static void strsubUTF8(char *dest, const char *src, uint32_t pos, uint32_t len)
srcIndex++;
}
if (!src[srcIndex])
if (!src[srcIndex] && len)
warning(WARNING_BUILTIN_ARG, "STRSUB: Position %lu is past the end of the string",
(unsigned long)pos);