- fix: Crash when directive line ends with '\' and at the last line.

This commit is contained in:
Roy Qu 2023-03-18 10:34:37 +08:00
parent f4f67d0b91
commit 1470f58206
2 changed files with 3 additions and 2 deletions

View File

@ -23,6 +23,7 @@ Red Panda C++ Version 2.18
- enhancement: Add option in the debug settings, to limit the length of the ouput generated by gdb for arrays. - enhancement: Add option in the debug settings, to limit the length of the ouput generated by gdb for arrays.
- enhancement: Show shortcut info in toolbar's tooltip. - enhancement: Show shortcut info in toolbar's tooltip.
- change: Use F11 as the shortcut for "Run". (It's the old shortcut for "Compile&Run") - change: Use F11 as the shortcut for "Run". (It's the old shortcut for "Compile&Run")
- fix: Crash when directive line ends with '\' and at the last line.
Red Panda C++ Version 2.17 Red Panda C++ Version 2.17

View File

@ -1071,9 +1071,9 @@ void CppPreprocessor::preprocessBuffer()
void CppPreprocessor::skipToEndOfPreprocessor() void CppPreprocessor::skipToEndOfPreprocessor()
{ {
int bufferCount = mBuffer.count(); int indexLimit = mBuffer.count()-1;
// Skip until last char of line is NOT \ anymore // Skip until last char of line is NOT \ anymore
while ((mIndex < bufferCount) && mBuffer[mIndex].endsWith('\\')) while ((mIndex < indexLimit) && mBuffer[mIndex].endsWith('\\'))
mIndex++; mIndex++;
} }