Browse Source

Merge topic 'use-generator-target'

aa29e64 Add a null check to the generator target accessor.
Brad King 12 years ago
parent
commit
a6080587aa
1 changed files with 5 additions and 2 deletions
  1. 5 2
      Source/cmMakefile.cxx

+ 5 - 2
Source/cmMakefile.cxx

@@ -4086,8 +4086,11 @@ bool cmMakefile::IsAlias(const char *name)
 //----------------------------------------------------------------------------
 cmGeneratorTarget* cmMakefile::FindGeneratorTargetToUse(const char* name)
 {
-  cmTarget *t = this->FindTargetToUse(name);
-  return this->LocalGenerator->GetGlobalGenerator()->GetGeneratorTarget(t);
+  if (cmTarget *t = this->FindTargetToUse(name))
+    {
+    return this->LocalGenerator->GetGlobalGenerator()->GetGeneratorTarget(t);
+    }
+  return 0;
 }
 
 //----------------------------------------------------------------------------