ublox: return error when no bands are parsed

If load_current_bands_finish() returns a NULL GArray, we must set the
GError or otherwise the daemon will segfault when the caller
dereferences the GError:

    current_bands = MM_IFACE_MODEM_GET_INTERFACE (self)->load_current_bands_finish (self, res, &error);
    if (!current_bands) {
        /* Errors when getting current bands won't be critical */
        mm_warn ("couldn't load current Bands: '%s'", error->message);
        g_error_free (error);
    }

This may happen with an empty but balid +UACT response, e.g.:
   AT+UACT?
   +UACT: ,,,
   OK

Or when it replies a full empty string:
   AT+UACT?
   OK
This commit is contained in:
Aleksander Morgado
2019-06-13 10:26:53 +02:00
parent d197380095
commit 20c5d7fd92
+4
View File
@@ -1578,6 +1578,10 @@ mm_ublox_parse_uact_response (const gchar *response,
g_array_unref (nums);
}
if (!bands)
g_set_error (error, MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
"No known band selection values matched in +UACT response: '%s'", response);
return bands;
}