1
0
Fork 0
mirror of https://gitlab.com/niansa/pilang3.git synced 2025-03-06 20:49:20 +01:00

Fixed crash in evaluator

This commit is contained in:
niansa 2021-02-10 20:10:03 +01:00
parent 0236ed50ab
commit 823ee09e94

View file

@ -37,7 +37,7 @@ namespace Pilang3 {
bool newarg = false; bool newarg = false;
bool escapenext = false; bool escapenext = false;
std::string cache; std::string cache;
for (auto characterit = expression.begin() + tspaces; characterit != expression.end(); characterit++) { for (auto characterit = expression.begin() + tspaces; characterit < expression.end(); characterit++) {
char character = *characterit; char character = *characterit;
// Start new command name // Start new command name
if (in_command_name) { if (in_command_name) {
@ -160,6 +160,9 @@ namespace Pilang3 {
thisfunc->evalChain.push_back(evaluation); thisfunc->evalChain.push_back(evaluation);
// Skip over expression in iteration // Skip over expression in iteration
character = *(characterit += evaluation->exprlen + 1); character = *(characterit += evaluation->exprlen + 1);
if (characterit == expression.end()) {
throw exceptions::UnexpectedEndOfExpression();
}
} }
character = *(++characterit); character = *(++characterit);
thisarg.data = thisfunc; thisarg.data = thisfunc;