diff --git a/NEWS.md b/NEWS.md index a7d1d7b9..ca6c6bb8 100644 --- a/NEWS.md +++ b/NEWS.md @@ -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: Show shortcut info in toolbar's tooltip. - 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 diff --git a/RedPandaIDE/parser/cpppreprocessor.cpp b/RedPandaIDE/parser/cpppreprocessor.cpp index 5d2ba57f..4cf038d2 100644 --- a/RedPandaIDE/parser/cpppreprocessor.cpp +++ b/RedPandaIDE/parser/cpppreprocessor.cpp @@ -1071,9 +1071,9 @@ void CppPreprocessor::preprocessBuffer() void CppPreprocessor::skipToEndOfPreprocessor() { - int bufferCount = mBuffer.count(); + int indexLimit = mBuffer.count()-1; // Skip until last char of line is NOT \ anymore - while ((mIndex < bufferCount) && mBuffer[mIndex].endsWith('\\')) + while ((mIndex < indexLimit) && mBuffer[mIndex].endsWith('\\')) mIndex++; }