[KIO-MTP] Fix null pointer dereference

Authored by feverfew on Apr 2 2020, 5:16 PM.

Description

[KIO-MTP] Fix null pointer dereference

Summary:
A null pointer can be returned from getDevice() if a device is disconnected.
Passing NULL into LIBMTP_Get_Storage() results in a NULL pointer dereference.

BUG: 405838

Test Plan:
Compiles. I couldn't reproduce this as described in the bug report, but from
reading the attached stacktrace in the bug report it's obvious what went wrong
here.

Reviewers: akrutzler, dfaure, elvisangelaccio

Reviewed By: elvisangelaccio

Subscribers: anthonyfieroni, kde-frameworks-devel, fvogt, kfm-devel, ngraham

Tags: Dolphin, Frameworks

Differential Revision: https://phabricator.kde.org/D28535

Details