bearer-qmi: app specific info in PCO may be empty

ModemManager[562783]: <err> [1673538458.350130] mm_utils_bin2hexstr: assertion 'bin != NULL' failed
  ModemManager[562783]: <dbg> [1673538458.350167] [modem0/bearer0] container ID: 0
  ModemManager[562783]: <dbg> [1673538458.350201] [modem0/bearer0] app specific info: (null)

Treat it better by only trying to build the app specific info string
if there are contents in the array.
This commit is contained in:
Aleksander Morgado
2023-01-16 14:50:33 +00:00
parent 34ba11b3fa
commit cf59b497bc

View File

@@ -566,13 +566,22 @@ process_operator_reserved_pco (MMBearerQmi *self,
guint8 pco_prefix[9];
gsize pco_raw_len;
if (!qmi_message_wds_get_current_settings_output_get_operator_reserved_pco (output, &tmp_mcc, &tmp_mnc, &mnc_includes_pcs_digit, &array, &container_id, NULL))
if (!qmi_message_wds_get_current_settings_output_get_operator_reserved_pco (
output,
&tmp_mcc,
&tmp_mnc,
&mnc_includes_pcs_digit,
&array,
&container_id,
NULL))
return;
app_specific_info_str = mm_utils_bin2hexstr ((guint8*) (array->data), array->len);
app_specific_info_str = ((array->len > 0) ?
mm_utils_bin2hexstr ((guint8*) (array->data), array->len) :
NULL);
mm_obj_dbg (self, "container ID: %d", container_id);
mm_obj_dbg (self, "app specific info: %s", app_specific_info_str);
mm_obj_dbg (self, "app specific info: %s", app_specific_info_str ? app_specific_info_str : "n/a");
pco_raw_len = sizeof (pco_prefix) + array->len;
pco_prefix[0] = 0x27;
@@ -610,6 +619,7 @@ process_operator_reserved_pco (MMBearerQmi *self,
pco_raw = g_byte_array_sized_new (pco_raw_len);
g_byte_array_append (pco_raw, pco_prefix, sizeof (pco_prefix));
if (array->len > 0)
g_byte_array_append (pco_raw, (const guint8 *)array->data, array->len);
pco = mm_pco_new ();