summaryrefslogtreecommitdiff
path: root/source/slang
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang')
-rw-r--r--source/slang/source-loc.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/source/slang/source-loc.cpp b/source/slang/source-loc.cpp
index b67426053..c66fdedb5 100644
--- a/source/slang/source-loc.cpp
+++ b/source/slang/source-loc.cpp
@@ -234,9 +234,13 @@ const List<uint32_t>& SourceFile::getLineBreakOffsets()
// where a multi-byte sequence might encode
// the line break.
- int d = *cursor;
- if ((c^d) == ('\r' ^ '\n'))
- cursor++;
+ // Check to make sure that the EOF hasn't been reached.
+ if (cursor != end)
+ {
+ int d = *cursor;
+ if ((c ^ d) == ('\r' ^ '\n'))
+ cursor++;
+ }
m_lineBreakOffsets.add(uint32_t(cursor - begin));
break;