From 9b25048fc6af42bfd39fa6ead44f35d93e125fcc Mon Sep 17 00:00:00 2001 From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz> Date: Thu, 18 Oct 2018 19:07:22 +0200 Subject: [PATCH] fix segfault on unavailable previous result use --- alib2cli/src/ast/statements/PreviousResultStatement.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/alib2cli/src/ast/statements/PreviousResultStatement.h b/alib2cli/src/ast/statements/PreviousResultStatement.h index a6c1e9c3a8..f55f36410c 100644 --- a/alib2cli/src/ast/statements/PreviousResultStatement.h +++ b/alib2cli/src/ast/statements/PreviousResultStatement.h @@ -9,6 +9,8 @@ class PreviousResultStatement final : public Statement { public: virtual std::shared_ptr < abstraction::OperationAbstraction > translateAndEval ( const std::shared_ptr < abstraction::OperationAbstraction > & prev, Environment & ) const override { + if ( prev == nullptr ) + throw std::invalid_argument ( "There is no previous result to use." ); return prev; } -- GitLab