Don't crash when working with non-KTp accounts
ClosedPublic

Authored by poboiko on Sep 28 2018, 2:12 PM.

Details

Summary

Telepathy-Qt was not very happy when accountPath was an empty string: it crashed somewhere in Telepathy-Qt DBus handling code.
This simple check should avoid it.

Test Plan

The crash was catched during work on T9595: [KAddressbook] Use KPeople model for contact list, see scratch repo and "testab" application there.
We weren't able to show info for non-KTp account. With this patch, it no longer crashes.

Diff Detail

Repository
R145 KDE Telepathy Common Internals
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
poboiko requested review of this revision.Sep 28 2018, 2:12 PM
poboiko created this revision.
davidedmundson accepted this revision.Sep 28 2018, 2:24 PM
davidedmundson added a subscriber: davidedmundson.

Telepathy-Qt was not very happy when accountPath was an empty string: it crashed somewhere in Telepathy-Qt DBus handling code.

If that's the case would checking for an empty string be safer?

This revision is now accepted and ready to land.Sep 28 2018, 2:24 PM
This revision was automatically updated to reflect the committed changes.

Fails to build on:

https://build.kde.org/job/Applications/job/ktp-common-internals/job/kf5-qt5%20FreeBSDQt5.11/3/console

https://kci.pangea.pub/job/cosmic_unstable_ktp-common-internals/67/parsed_console/

with

17:06:28 /usr/home/jenkins/workspace/Applications/ktp-common-internals/kf5-qt5 FreeBSDQt5.11/kpeople/uiplugins/imdetailswidget.cpp:58:35: error: calling a private constructor of class 'QString'
17:06:28 if (!contactId.startsWith("ktp://")) {
17:06:28 ^
17:06:28 /usr/local/include/qt5/QtCore/qstring.h:829:5: note: declared private here
17:06:28 QString(const char *ch);
17:06:28 ^

Sorry for that! Of course it should be QStringLiteral("ktp://") instead. I've fixed it in master

Fails to build on:

https://build.kde.org/job/Applications/job/ktp-common-internals/job/kf5-qt5%20FreeBSDQt5.11/3/console

https://kci.pangea.pub/job/cosmic_unstable_ktp-common-internals/67/parsed_console/

with

17:06:28 /usr/home/jenkins/workspace/Applications/ktp-common-internals/kf5-qt5 FreeBSDQt5.11/kpeople/uiplugins/imdetailswidget.cpp:58:35: error: calling a private constructor of class 'QString'
17:06:28 if (!contactId.startsWith("ktp://")) {
17:06:28 ^
17:06:28 /usr/local/include/qt5/QtCore/qstring.h:829:5: note: declared private here
17:06:28 QString(const char *ch);
17:06:28 ^