altair: make sure parse_vendor_pco_info() always returns an error
The parse_vendor_pco_info() method was returning NULL without error if the pco info string was empty. Under this situation, the code would have tried to add a NULL MMPco into the pco_list list, which is not desired. Avoid this, by making sure a NULL return always sets an error.
This commit is contained in:
@@ -1105,9 +1105,13 @@ altair_pco_info_changed (MMPortSerialAt *port,
|
||||
|
||||
pco_info = g_match_info_fetch (match_info, 0);
|
||||
|
||||
/* ignore if empty */
|
||||
if (!pco_info || !pco_info[0])
|
||||
return;
|
||||
|
||||
mm_obj_dbg (self, "parsing vendor PCO info: %s", pco_info);
|
||||
pco = mm_altair_parse_vendor_pco_info (pco_info, &error);
|
||||
if (error) {
|
||||
if (!pco) {
|
||||
mm_obj_warn (self, "error parsing vendor PCO info: %s", error->message);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -140,9 +140,11 @@ mm_altair_parse_vendor_pco_info (const gchar *pco_info, GError **error)
|
||||
MMPco *pco = NULL;
|
||||
gint num_matches;
|
||||
|
||||
if (!pco_info[0])
|
||||
/* No APNs configured, all done */
|
||||
if (!pco_info || !pco_info[0]) {
|
||||
g_set_error (error, MM_CORE_ERROR, MM_CORE_ERROR_INVALID_ARGS,
|
||||
"No PCO info given");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Expected %PCOINFO response:
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user