aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiguel Costa <miguel.costa@qt.io>2017-07-25 13:43:13 +0200
committerMiguel Costa <miguel.costa@qt.io>2017-07-25 13:59:55 +0000
commitaf5dcc0ac037b902c6ce87fca7f71bdaeab96e41 (patch)
tree1ada610b768a51b4b8deed8e283f81238897ee73
parentbdfb953a695ffb2d07e58e05b68982c4a9820751 (diff)
Fix new item with VS not generating the moc
Checks if item is of type CustomBuild before accessing custom tool information. Accessing the custom tool information before setting the item type to CustomBuild generates an exception while adding the moc. Task-number: QTVSADDINBUG-396 Change-Id: Icec885894e6c3abd78b324f98a6028c41f1a2029 Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
-rw-r--r--src/qtprojectlib/HelperFunctions.cs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/qtprojectlib/HelperFunctions.cs b/src/qtprojectlib/HelperFunctions.cs
index f8fb9a91..b92e4f14 100644
--- a/src/qtprojectlib/HelperFunctions.cs
+++ b/src/qtprojectlib/HelperFunctions.cs
@@ -437,6 +437,10 @@ namespace QtProjectLib
/// <returns></returns>
static public VCCustomBuildTool GetCustomBuildTool(VCFileConfiguration config)
{
+ var file = config.File as VCFile;
+ if (file == null || file.ItemType != "CustomBuild")
+ return null;
+
var tool = config.Tool as VCCustomBuildTool;
if (tool == null)
return null;