diff options
| author | Orkun Tokdemir <orkun.tokdemir@qt.io> | 2024-11-20 18:31:08 +0100 |
|---|---|---|
| committer | Orkun Tokdemir <orkun.tokdemir@qt.io> | 2024-11-22 09:32:08 +0000 |
| commit | 121abdb88f6b79f8e8d247212f76d06cadcf3c91 (patch) | |
| tree | 8a853ddb312e1e26648148665e52b7841fb0bae2 /qt-cpp | |
| parent | e8c5af60466a11e611666231e3bc35ec22fbd762 (diff) | |
Fix wrong value evaluation for `processMessage()`
When only the value is checked whether it is undefined or not, it
doesn't give us the correct result because the value either can be
set to undefined or not set at all. We get undefined in both cases.
We should check the key is set in the message first instead.
Change-Id: Ic4c17e96c3975adcbc49eb82e7b1999d3dcec851
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Diffstat (limited to 'qt-cpp')
| -rw-r--r-- | qt-cpp/src/extension.ts | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/qt-cpp/src/extension.ts b/qt-cpp/src/extension.ts index c4d1da3..809435c 100644 --- a/qt-cpp/src/extension.ts +++ b/qt-cpp/src/extension.ts @@ -138,15 +138,18 @@ function processMessage(message: QtWorkspaceConfigMessage) { return; } } + for (const key of message.config.keys()) { + if (key === QtInsRootConfigName) { + const value = message.get<string>(QtInsRootConfigName) ?? ''; + void kitManager.onQtInstallationRootChanged(value, project?.folder); + continue; + } - const qtInsRoot = message.get<string>(QtInsRootConfigName); - if (qtInsRoot !== undefined) { - void kitManager.onQtInstallationRootChanged(qtInsRoot, project?.folder); - } - const additionalQtPaths = message.get<QtAdditionalPath[]>( - AdditionalQtPathsName - ); - if (additionalQtPaths !== undefined) { - kitManager.onQtPathsChanged(additionalQtPaths, project?.folder); + if (key === AdditionalQtPathsName) { + const additionalQtPaths = + message.get<QtAdditionalPath[]>(AdditionalQtPathsName) ?? []; + kitManager.onQtPathsChanged(additionalQtPaths, project?.folder); + continue; + } } } |
