Don't crash when copying a function with no closure variable.
authorIan Lance Taylor <ian@gcc.gnu.org>
Tue, 21 Dec 2010 22:56:39 +0000 (22:56 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Tue, 21 Dec 2010 22:56:39 +0000 (22:56 +0000)
From-SVN: r168140

gcc/go/gofrontend/expressions.h

index 5d7d90b..4780a8b 100644 (file)
@@ -1346,7 +1346,9 @@ class Func_expression : public Expression
   do_copy()
   {
     return Expression::make_func_reference(this->function_,
-                                          this->closure_->copy(),
+                                          (this->closure_ == NULL
+                                           ? NULL
+                                           : this->closure_->copy()),
                                           this->location());
   }