Glib emits a warning when g_hash_table_destroy() is called on a NULL
pointer:

  GLib-CRITICAL **: 13:27:40.269: g_hash_table_destroy: assertion 'hash_table 
!= NULL' failed

Add a check to avoid this warning.
---
 drivers/atmodem/atutil.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/atmodem/atutil.c b/drivers/atmodem/atutil.c
index 1db524e3..bbdb01c4 100644
--- a/drivers/atmodem/atutil.c
+++ b/drivers/atmodem/atutil.c
@@ -769,7 +769,9 @@ GAtChat *at_util_open_device(struct ofono_modem *modem, 
const char *key,
        }
 
        channel = g_at_tty_open(device, options);
-       g_hash_table_destroy(options);
+
+       if (options)
+               g_hash_table_destroy(options);
 
        if (channel == NULL)
                return NULL;
-- 
2.22.0

_______________________________________________
ofono mailing list
ofono@ofono.org
https://lists.ofono.org/mailman/listinfo/ofono

Reply via email to