Don't crash import unsafe if "unsafe" was already defined.
authorIan Lance Taylor <ian@gcc.gnu.org>
Tue, 22 Feb 2011 03:23:36 +0000 (03:23 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Tue, 22 Feb 2011 03:23:36 +0000 (03:23 +0000)
From-SVN: r170389

gcc/go/gofrontend/unsafe.cc

index e219f61edae79427c713ead47574ee24f53fe4f2..9d51b4d94244729e705d37fd42523c790b2160f7 100644 (file)
@@ -24,6 +24,13 @@ Gogo::import_unsafe(const std::string& local_name, bool is_local_name_exported,
                                                is_local_name_exported,
                                                "libgo_unsafe",
                                                location, &add_to_globals);
+
+  if (package == NULL)
+    {
+      gcc_assert(saw_errors());
+      return;
+    }
+
   package->set_is_imported();
 
   Bindings* bindings = package->bindings();