broadband-modem-qmi: avoid NULL success return in firmware_load_list

Instead of assuming that NULL is a valid return, make sure we return
an error instead.
This commit is contained in:
Aleksander Morgado
2017-10-20 17:46:40 +02:00
parent 6044118b64
commit dbb4597e33
2 changed files with 14 additions and 5 deletions

View File

@@ -99,10 +99,15 @@ load_list_ready (MMIfaceModemFirmware *self,
GError *error = NULL;
ctx->list = MM_IFACE_MODEM_FIRMWARE_GET_INTERFACE (self)->load_list_finish (self, res, &error);
if (error) {
g_dbus_method_invocation_take_error (ctx->invocation, error);
handle_list_context_free (ctx);
return;
if (!ctx->list) {
/* Not found isn't fatal */
if (!g_error_matches (error, MM_CORE_ERROR, MM_CORE_ERROR_NOT_FOUND)) {
g_dbus_method_invocation_take_error (ctx->invocation, error);
handle_list_context_free (ctx);
return;
}
mm_dbg ("Couldn't load firmware image list: %s", error->message);
g_clear_error (&error);
}
MM_IFACE_MODEM_FIRMWARE_GET_INTERFACE (self)->load_current (MM_IFACE_MODEM_FIRMWARE (self),