]> git.tdb.fi Git - libs/gl.git/commitdiff
Don't try to access a nonexistent return expression
authorMikko Rasa <tdb@tdb.fi>
Fri, 24 May 2019 22:04:44 +0000 (01:04 +0300)
committerMikko Rasa <tdb@tdb.fi>
Fri, 24 May 2019 22:04:44 +0000 (01:04 +0300)
source/programcompiler.cpp

index 1a3cd34fae5067201f81dabf8ffcdf76121b0d59..c2ebb4b96ad3e474b2f636578e404601282b82ad 100644 (file)
@@ -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 += ';';
 }