diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2020-06-24 09:31:30 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2020-06-24 09:31:30 +0200 |
commit | 408e9f327e09cda73ab87c92aab34176186d2c3d (patch) | |
tree | 0a8d5a88cfdc0f7f54269fa689c81aaa1598f430 | |
parent | c6d213d6523a70aa8504bda4dbd1796a0b1cd4c7 (diff) |
broadband-modem-qmi: fix assertion when disabling unsolicited events
Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/230
-rw-r--r-- | src/mm-broadband-modem-qmi.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/mm-broadband-modem-qmi.c b/src/mm-broadband-modem-qmi.c index 6125cd4f..e3a616ae 100644 --- a/src/mm-broadband-modem-qmi.c +++ b/src/mm-broadband-modem-qmi.c @@ -4739,17 +4739,17 @@ common_enable_disable_unsolicited_events_signal_strength (GTask *task) g_autoptr(QmiMessageNasSetEventReportInput) input = NULL; g_autoptr(GArray) thresholds = NULL; - ctx = g_task_get_task_data (task); + /* The device doesn't really like to have many threshold values, so don't + * grow this array without checking first */ + static const gint8 thresholds_data[] = { -80, -40, 0, 40, 80 }; - /* Only set thresholds during enable */ - if (ctx->enable) { - /* The device doesn't really like to have many threshold values, so don't - * grow this array without checking first */ - static const gint8 thresholds_data[] = { -80, -40, 0, 40, 80 }; + ctx = g_task_get_task_data (task); - thresholds = g_array_sized_new (FALSE, FALSE, sizeof (gint8), G_N_ELEMENTS (thresholds_data)); + /* Only set thresholds during enable, but always create the array anyway, + * as the TLV setter expects it */ + thresholds = g_array_sized_new (FALSE, FALSE, sizeof (gint8), G_N_ELEMENTS (thresholds_data)); + if (ctx->enable) g_array_append_vals (thresholds, thresholds_data, G_N_ELEMENTS (thresholds_data)); - } input = qmi_message_nas_set_event_report_input_new (); qmi_message_nas_set_event_report_input_set_signal_strength_indicator ( |