diff --git a/NEWS.md b/NEWS.md index 02c51855..3b624147 100644 --- a/NEWS.md +++ b/NEWS.md @@ -18,6 +18,7 @@ Red Panda C++ Version 2.10 - change: Project's encoding shouldn't be set to "auto detect" - fix: Can't correctly set project file's encoding back to 'UTF-8'/'ANSI' in the project options dialog/files setting page. - enhancement: Simplified chinese translations for encoding names. + - fix: Crash when there are preprocessing directives like '#if 0/0' or '#if 0%0' Red Panda C++ Version 2.9 diff --git a/RedPandaIDE/debugger.cpp b/RedPandaIDE/debugger.cpp index e98436e0..d84c96fc 100644 --- a/RedPandaIDE/debugger.cpp +++ b/RedPandaIDE/debugger.cpp @@ -634,10 +634,10 @@ void Debugger::sendBreakpointCommand(PBreakpoint breakpoint) .arg(condition, filename) .arg(breakpoint->line)); } else { - // sendCommand("-break-insert", - // QString("%1 --source \"%2\" --line %3") - // .arg(condition,filename) - // .arg(breakpoint->line)); + sendCommand("-break-insert", + QString("%1 --source \"%2\" --line %3") + .arg(condition,filename) + .arg(breakpoint->line)); } } } diff --git a/RedPandaIDE/parser/cpppreprocessor.cpp b/RedPandaIDE/parser/cpppreprocessor.cpp index 9aba6b25..9cf5e7e2 100644 --- a/RedPandaIDE/parser/cpppreprocessor.cpp +++ b/RedPandaIDE/parser/cpppreprocessor.cpp @@ -1441,12 +1441,18 @@ bool CppPreprocessor::evalMulExpr(const QString &expr, int &result, int &pos) pos++; if (!evalUnaryExpr(expr,rightResult,pos)) return false; - result /= rightResult; + if (rightResult != 0) + result /= rightResult; + else + result = 0; } else if (expr[pos]=='%') { pos++; if (!evalUnaryExpr(expr,rightResult,pos)) return false; - result %= rightResult; + if (rightResult != 0) + result %= rightResult; + else + result = 0; } else { break; }