fvogt added a comment.
There is no such thing as an "invalid device" at that point anymore. There's only nullptr. LIBMTP_mtpdevice_t *MTPDevice::getDevice() { if (!m_mtpdevice->storage) { qCDebug(LOG_KIOD_KMTPD) << "no storage found: reopen mtpdevice"; LIBMTP_Release_Device(m_mtpdevice); m_mtpdevice = LIBMTP_Open_Raw_Device_Uncached(&m_rawdevice); } return m_mtpdevice; } What you're suggesting is to change `MTPDevice::getDevice` to return the old device if reopening fails - but reopening without releasing might not work. REPOSITORY R320 KIO Extras REVISION DETAIL https://phabricator.kde.org/D28535 To: feverfew, akrutzler, dfaure, elvisangelaccio Cc: anthonyfieroni, kde-frameworks-devel, fvogt, kfm-devel, ngraham, nikolaik, pberestov, iasensio, fprice, LeGast00n, cblack, fbampaloukas, alexde, GB_2, Codezela, feverfew, meven, michaelh, spoorun, navarromorales, firef, andrebarros, bruns, emmanuelp, mikesomov