From c84cafda182da0ee37976a398f09faaf044a5af0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20L=C3=BChne?= Date: Sat, 17 Jun 2017 17:06:49 +0200 Subject: [PATCH] Fixed constant parsing if no problem is specified. --- lib/pddlparse/src/pddlparse/detail/parsing/Constant.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/pddlparse/src/pddlparse/detail/parsing/Constant.cpp b/lib/pddlparse/src/pddlparse/detail/parsing/Constant.cpp index 718302d..3cd8774 100644 --- a/lib/pddlparse/src/pddlparse/detail/parsing/Constant.cpp +++ b/lib/pddlparse/src/pddlparse/detail/parsing/Constant.cpp @@ -77,10 +77,13 @@ ast::ConstantPointer parseConstant(Context &context, ASTContext &astContext) if (constant) return std::move(constant.value()); - constant = findConstant(constantName, astContext.problem.value()->objects); + if (astContext.problem) + { + constant = findConstant(constantName, astContext.problem.value()->objects); - if (constant) - return std::move(constant.value()); + if (constant) + return std::move(constant.value()); + } throw ParserException(tokenizer.location(), "constant “" + constantName + "” used but never declared"); }