diff options
author | Miguel Costa <miguel.costa@qt.io> | 2021-10-14 12:11:32 +0200 |
---|---|---|
committer | Miguel Costa <miguel.costa@qt.io> | 2021-10-14 11:46:37 +0000 |
commit | 9707183ac5953d883a18236238a843cb3abef319 (patch) | |
tree | 3acc39dc9b1f18c52de13e6791dea10039b2629b /src | |
parent | 66be01bc8625f84e93190086d248bab94841bdc0 (diff) |
Raise exception on error in modules file
When a required element is missing from the Qt modules XML file, an
exception will now be raised and initialization of the extension will
be aborted. Previously, errors were not detected during init, which
caused null-ref errors while using the extension.
Fixes: QTVSADDINBUG-931
Change-Id: Ife5410329f8cc69619c34ba81f5bf2141541db5c
Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/qtvstools.core/QtModules.cs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/qtvstools.core/QtModules.cs b/src/qtvstools.core/QtModules.cs index a7d69efa..c4bf2cb8 100644 --- a/src/qtvstools.core/QtModules.cs +++ b/src/qtvstools.core/QtModules.cs @@ -100,6 +100,11 @@ namespace QtVsTools.Core moduleInfo.AdditionalLibrariesDebug = xModule.Elements("AdditionalLibrariesDebug") .Select(x => x.Value).ToList(); + if (string.IsNullOrEmpty(moduleInfo.Name) + || string.IsNullOrEmpty(moduleInfo.LibraryPrefix)) { + Messages.Print("\r\nCritical error: incorrect format of qtmodules.xml"); + throw new QtVSException("qtmodules.xml"); + } dictModuleInfos.Add(moduleId, moduleInfo); } } |