From: Mikko Rasa Date: Fri, 24 May 2019 22:04:44 +0000 (+0300) Subject: Don't try to access a nonexistent return expression X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=437cd7d38fea1533aab9414d4575acb63d6b9170;p=libs%2Fgl.git Don't try to access a nonexistent return expression --- 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 += ';'; }