diff options
-rw-r--r-- | source/blender/blenlib/intern/string.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c index 6d75f7c4131..6cc00fc60ee 100644 --- a/source/blender/blenlib/intern/string.c +++ b/source/blender/blenlib/intern/string.c @@ -379,12 +379,13 @@ escape_finish: */ char *BLI_str_quoted_substrN(const char *__restrict str, const char *__restrict prefix) { - size_t prefixLen = strlen(prefix); const char *startMatch, *endMatch; - + /* get the starting point (i.e. where prefix starts, and add prefixLen+1 to it to get be after the first " */ - startMatch = strstr(str, prefix) + prefixLen + 1; + startMatch = strstr(str, prefix); if (startMatch) { + const size_t prefixLen = strlen(prefix); + startMatch += prefixLen + 1; /* get the end point (i.e. where the next occurance of " is after the starting point) */ endMatch = startMatch; |