KitInformation: Improve robustness to nullptr passed as kit

All the KitInformation methods need to gracefully handle a kit that is
a nullptr. Ensure this is indeed the case.

This might fix the actual trigger for QTCREATORBUG-19469.

Change-Id: Id78ac8a26c1be908f41a425ff1935b86888e4b8b
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Tobias Hunger
2018-02-12 12:49:22 +01:00
parent d5c449575e
commit 3874b6b6ec
7 changed files with 68 additions and 23 deletions

View File

@@ -29,6 +29,7 @@
#include <utils/pathchooser.h>
#include <utils/elidinglabel.h>
#include <utils/qtcassert.h>
#include <QDialogButtonBox>
#include <QLabel>
@@ -73,6 +74,7 @@ KitInformation::ItemList AndroidGdbServerKitInformation::toUserOutput(const Kit
KitConfigWidget *AndroidGdbServerKitInformation::createConfigWidget(Kit *kit) const
{
QTC_ASSERT(kit, return nullptr);
return new AndroidGdbServerKitInformationWidget(kit, this);
}
@@ -94,11 +96,13 @@ bool AndroidGdbServerKitInformation::isAndroidKit(const Kit *kit)
FileName AndroidGdbServerKitInformation::gdbServer(const Kit *kit)
{
QTC_ASSERT(kit, return FileName());
return FileName::fromString(kit->value(AndroidGdbServerKitInformation::id()).toString());
}
void AndroidGdbServerKitInformation::setGdbSever(Kit *kit, const FileName &gdbServerCommand)
{
QTC_ASSERT(kit, return);
kit->setValue(AndroidGdbServerKitInformation::id(), gdbServerCommand.toString());
}