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.
This commit is contained in:
Martin Hundebøll 2019-07-03 20:09:47 +02:00 committed by Denis Kenzior
parent 7f065625ca
commit 181e8d3da7
1 changed files with 3 additions and 1 deletions

View File

@ -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;