Fix crashing devicetest

Summary:
When running the test m_impl will be nullptr leading to a crash. This is because when running as a test no platform is loaded.
The fancy way to solve this would be to have a TestImpl, but I think this is enough.

Test Plan: Test passes now

Reviewers: #kde_connect, apol

Reviewed By: #kde_connect, apol

Subscribers: kdeconnect, #kde_connect

Tags: #kde_connect

Differential Revision: https://phabricator.kde.org/D13629
This commit is contained in:
Nicolas Fella 2018-07-12 16:14:32 +02:00
parent f094408171
commit 48108cd316
2 changed files with 6 additions and 1 deletions

View file

@ -82,7 +82,9 @@ bool MousepadPlugin::receivePacket(const NetworkPacket& np)
void MousepadPlugin::connected() {
NetworkPacket np(PACKET_TYPE_MOUSEPAD_KEYBOARDSTATE);
np.set<bool>(QStringLiteral("state"), m_impl->hasKeyboardSupport());
if (m_impl) {
np.set<bool>(QStringLiteral("state"), m_impl->hasKeyboardSupport());
}
sendPacket(np);
}

View file

@ -94,6 +94,9 @@ void DeviceTest::testPairedDevice()
void DeviceTest::testUnpairedDevice()
{
KdeConnectConfig* kcc = KdeConnectConfig::instance();
kcc->removeTrustedDevice(deviceId);
LanLinkProvider linkProvider;
QSslSocket socket;
LanDeviceLink* link = new LanDeviceLink(deviceId, &linkProvider, &socket, LanDeviceLink::Locally);