From 437cd7d38fea1533aab9414d4575acb63d6b9170 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sat, 25 May 2019 01:04:44 +0300 Subject: [PATCH] Don't try to access a nonexistent return expression --- source/programcompiler.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/source/programcompiler.cpp b/source/programcompiler.cpp index 1a3cd34f..c2ebb4b9 100644 --- a/source/programcompiler.cpp +++ b/source/programcompiler.cpp @@ -557,8 +557,12 @@ void ProgramCompiler::Formatter::visit(Iteration &iter) void ProgramCompiler::Formatter::visit(Return &ret) { - formatted += "return "; - ret.expression->visit(*this); + formatted += "return"; + if(ret.expression) + { + formatted += ' '; + ret.expression->visit(*this); + } formatted += ';'; } -- 2.45.2