Commit 1e289501 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧 Committed by Aleix Pol Gonzalez
Browse files

flatpak: Check for errors before using the value


(cherry picked from commit c37e9be4)
parent dc67ef22
......@@ -95,6 +95,10 @@ void FlatpakNotifier::loadRemoteUpdates(Installation *installation)
g_autoptr(GPtrArray) fetchedUpdates = flatpak_installation_list_installed_refs_for_update(installation->m_installation, cancellable, &localError);
bool hasUpdates = false;
if (!fetchedUpdates) {
qWarning() << "Failed to get list of installed refs for listing updates: " << localError->message;
return false;
}
for (uint i = 0; !hasUpdates && i < fetchedUpdates->len; i++) {
FlatpakInstalledRef *ref = FLATPAK_INSTALLED_REF(g_ptr_array_index(fetchedUpdates, i));
const QString refName = QString::fromUtf8(flatpak_ref_get_name(FLATPAK_REF(ref)));
......@@ -106,9 +110,6 @@ void FlatpakNotifier::loadRemoteUpdates(Installation *installation)
}
hasUpdates = true;
}
if (!fetchedUpdates) {
qWarning() << "Failed to get list of installed refs for listing updates: " << localError->message;
}
return hasUpdates;
}));
}
......
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