From caad8074de37db4eccfa9daf392cf1d7f70ff70d Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Wed, 17 May 2023 17:24:28 +0200 Subject: WebAssembly: Prevent null pointer access The detector.device can be nullptr Amends: cacc4aeede245ddc92a196e99fb1e66458d4403c Change-Id: I5b9b6aa722c8e6e8a96d05cdf2f1b214735db858 Reviewed-by: hjk --- src/plugins/webassembly/webassemblytoolchain.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/webassembly/webassemblytoolchain.cpp b/src/plugins/webassembly/webassemblytoolchain.cpp index 4ee3eff591..c413f27566 100644 --- a/src/plugins/webassembly/webassemblytoolchain.cpp +++ b/src/plugins/webassembly/webassemblytoolchain.cpp @@ -96,7 +96,8 @@ static Toolchains doAutoDetect(const ToolchainDetector &detector) if (!WebAssemblyEmSdk::isValid(sdk)) return {}; - if (detector.device->type() != ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE) { + if (detector.device + && detector.device->type() != ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE) { // Only detect toolchains from the emsdk installation device const FilePath deviceRoot = detector.device->rootPath(); if (deviceRoot.host() != sdk.host()) -- cgit v1.2.1