From ae32622bcfe4aee667b749f89e61d9a4fe44c762 Mon Sep 17 00:00:00 2001
Message-Id: <ae32622bcfe4aee667b749f89e61d9a4fe44c762.1394632633.git.brad.king@kitware.com>
From: Brad King <brad.king@kitware.com>
Date: Wed, 12 Mar 2014 09:54:20 -0400
Subject: [PATCH] cmake-gui: Fix handling of missing CMAKE_EXTRA_GENERATOR
 (#14804)

Since commit 1a1b737c (stringapi: Use strings for generator names,
2014-02-24) cmExternalMakefileProjectGenerator::CreateFullGeneratorName
expects a std::string instead of const char*.  When no extra generator
name is available, pass an empty string to avoid NULL dereference.
---
 Source/QtDialog/QCMake.cxx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx
index 12da320..5f9ebaf 100644
--- a/Source/QtDialog/QCMake.cxx
+++ b/Source/QtDialog/QCMake.cxx
@@ -117,7 +117,7 @@ void QCMake::setBinaryDirectory(const QString& _dir)
       {
       const char* extraGen = cachem->GetCacheValue("CMAKE_EXTRA_GENERATOR");
       std::string curGen = cmExternalMakefileProjectGenerator::
-                              CreateFullGeneratorName(itm.GetValue(), extraGen);
+        CreateFullGeneratorName(itm.GetValue(), extraGen? extraGen : "");
       this->setGenerator(QString::fromLocal8Bit(curGen.c_str()));
       }
     }
-- 
1.8.5.2

