From 181e8d3da7b8382b9e62d53417a4502a84fdcfdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Hundeb=C3=B8ll?= Date: Wed, 3 Jul 2019 20:09:47 +0200 Subject: [PATCH] atutil: guard call to g_hash_table_destroy() 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;