RemoteLinux: Guard against nullptr access

This fixes a potential crash when switching the device of a kit.

Change-Id: Ibdce9859cb347401706fe4de1c56aa8bb890233b
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Stenger
2023-07-07 13:12:23 +02:00
parent 942a9d0519
commit 5e55e70f52

View File

@@ -38,7 +38,7 @@ public:
auto fetchButton = new QPushButton(Tr::tr("Fetch Device Environment"));
addWidget(fetchButton);
connect(target, &Target::kitChanged, [aspect] { aspect->setRemoteEnvironment({}); });
connect(target, &Target::kitChanged, aspect, [aspect] { aspect->setRemoteEnvironment({}); });
connect(fetchButton, &QPushButton::clicked, this, [aspect, target] {
if (IDevice::ConstPtr device = DeviceKitAspect::device(target->kit())) {