Don't crash if the fwupd error is null

I got a difficult-to-reproduce crash, which pointed at the fact that
this error can, at times, be null. Without the validity check this
patch introduces, we then attempted to deref that null pointer, and
crashed.

Differential Revision: https://phabricator.kde.org/D19561
parent e9e26245
......@@ -347,7 +347,7 @@ void FwupdBackend::refreshRemote(FwupdBackend* backend, FwupdRemote* remote, qui
void FwupdBackend::handleError(GError *perror)
{
//TODO: localise the error message
if (!g_error_matches(perror, FWUPD_ERROR, FWUPD_ERROR_INVALID_FILE) && !g_error_matches(perror, FWUPD_ERROR, FWUPD_ERROR_NOTHING_TO_DO)) {
if (perror && !g_error_matches(perror, FWUPD_ERROR, FWUPD_ERROR_INVALID_FILE) && !g_error_matches(perror, FWUPD_ERROR, FWUPD_ERROR_NOTHING_TO_DO)) {
const QString msg = QString::fromUtf8(perror->message);
QTimer::singleShot(0, this, [this, msg](){
Q_EMIT passiveMessage(msg);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment