diff --git a/src/plugins/qt4projectmanager/qt4project.cpp b/src/plugins/qt4projectmanager/qt4project.cpp
index 6a27c484b808dc19d8c066fe8fdaeb15daf2d765..05be102b81c7730eb37ebd10d417d781dc84524b 100644
--- a/src/plugins/qt4projectmanager/qt4project.cpp
+++ b/src/plugins/qt4projectmanager/qt4project.cpp
@@ -457,8 +457,12 @@ void Qt4Project::updateCodeModel()
     const QString newQtLibsPath = versionInfo.value(QLatin1String("QT_INSTALL_LIBS"));
 
     ToolChain *tc = toolChain(activeBuildConfiguration());
-    QByteArray predefinedMacros = tc->predefinedMacros();
-    QList<HeaderPath> allHeaderPaths = tc->systemHeaderPaths();
+    QByteArray predefinedMacros;
+    QList<HeaderPath> allHeaderPaths;
+    if (tc) {
+        predefinedMacros = tc->predefinedMacros();
+        allHeaderPaths = tc->systemHeaderPaths();
+    }
     foreach (HeaderPath headerPath, allHeaderPaths) {
         if (headerPath.kind() == HeaderPath::FrameworkHeaderPath)
             allFrameworkPaths.append(headerPath.path());