From 77b8198c2b1eadcd3f3a6bb9d97275d0f2d05a14 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Mon, 5 Dec 2016 15:19:55 +0100 Subject: [PATCH] RemoteLinux: Make sure there is a DebuggerRCAspect Only offer to run runconfigs with the DebuggerRCAspect set, assert that it is indeed there and never check for it again. Change-Id: I5e9b329efb15d56ae221aed3ea2a75caa1078c18 Reviewed-by: hjk Reviewed-by: Christian Kandeler --- src/plugins/remotelinux/remotelinuxruncontrolfactory.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/remotelinux/remotelinuxruncontrolfactory.cpp b/src/plugins/remotelinux/remotelinuxruncontrolfactory.cpp index 3926e40d675..de744082719 100644 --- a/src/plugins/remotelinux/remotelinuxruncontrolfactory.cpp +++ b/src/plugins/remotelinux/remotelinuxruncontrolfactory.cpp @@ -70,6 +70,7 @@ bool RemoteLinuxRunControlFactory::canRun(RunConfiguration *runConfiguration, Co } const Core::Id id = runConfiguration->id(); + QTC_ASSERT(runConfiguration->extraAspect(), return false); return runConfiguration->isEnabled() && (id == RemoteLinuxCustomRunConfiguration::runConfigId() || id.name().startsWith(RemoteLinuxRunConfiguration::IdPrefix)); @@ -96,7 +97,9 @@ RunControl *RemoteLinuxRunControlFactory::create(RunConfiguration *runConfig, Co } auto aspect = runConfig->extraAspect(); - int portsUsed = aspect ? aspect->portsUsedByDebugger() : 0; + QTC_ASSERT(aspect, return 0); + + int portsUsed = aspect->portsUsedByDebugger(); if (portsUsed > dev->freePorts().count()) { *errorMessage = tr("Cannot debug: Not enough free ports available."); return 0;