Browse Source

BUG: fix for bug 7228 FLTK_WRAP_UI segfault fixed

Bill Hoffman 17 years ago
parent
commit
8ef1cedbef
1 changed files with 13 additions and 1 deletions
  1. 13 1
      Source/cmFLTKWrapUICommand.cxx

+ 13 - 1
Source/cmFLTKWrapUICommand.cxx

@@ -121,8 +121,20 @@ void cmFLTKWrapUICommand::FinalPass()
   // people should add the srcs to the target themselves, but the old command
   // didn't support that, so check and see if they added the files in and if
   // they didn;t then print a warning and add then anyhow
+  cmTarget* target = this->Makefile->FindTarget(this->Target.c_str());
+  if(!target)
+    {
+    std::string msg = 
+      "FLTK_WRAP_UI was called with a target that was never created: ";
+    msg += this->Target;
+    msg +=".  The problem was found while processing the source directory: ";
+    msg += this->Makefile->GetStartDirectory();
+    msg += ".  This FLTK_WRAP_UI call will be ignored.";
+    cmSystemTools::Message(msg.c_str(),"Warning");
+    return;
+    }
   std::vector<cmSourceFile*> const& srcs = 
-    this->Makefile->GetTargets()[this->Target].GetSourceFiles();
+    target->GetSourceFiles();
   bool found = false;
   for (unsigned int i = 0; i < srcs.size(); ++i)
     {