summaryrefslogtreecommitdiff
path: root/source/slang/slang-workspace-version.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-workspace-version.cpp')
-rw-r--r--source/slang/slang-workspace-version.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/source/slang/slang-workspace-version.cpp b/source/slang/slang-workspace-version.cpp
index ed568b470..86cdd000a 100644
--- a/source/slang/slang-workspace-version.cpp
+++ b/source/slang/slang-workspace-version.cpp
@@ -451,6 +451,9 @@ UnownedStringSlice DocumentVersion::peekIdentifier(Index& offset)
{
Index start = offset;
Index end = offset;
+ if (start >= text.getLength())
+ return UnownedStringSlice("");
+
while (start >= 0 && _isIdentifierChar(text[start]))
start--;
while (end < text.getLength() && _isIdentifierChar(text[end]))