[KCModuleInfo] Don't access KPluginInfo unless it's valid

Authored by ahmadsamir on May 20 2020, 7:30 PM.

Description

[KCModuleInfo] Don't access KPluginInfo unless it's valid

systemsettings creates a KService for .desktop files with
X-KDE-ServiceTypes=SystemSettingsExternalApp, in such cases there is no
actual module, it just launches an external app, so IIUC there is no
valid metadata and that is why constructing a KPluginInfo from that
KService fails, stepping into the code with gdb confirms this.

It makes sense to not access the KPluginInfo private member of
KCModuleInfo unless it is valid, so that service(), which is used by
some users of the class to check whether the KCModuleInfo object is
valid or not, doesn't cause a crash.

CCBUG: 421566

Details

Committed
ahmadsamirMay 20 2020, 7:30 PM
Parents
R295:c76836d67905: GIT_SILENT: we don't use phabricator anymore
Branches
Unknown
Tags
Unknown
References
work/ahmad/kplugininfo-service