From: Wolfram Sang Date: Tue, 7 Apr 2020 22:31:32 +0000 (+0200) Subject: decode: add sanity check when mapping channels X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=172d2b302de1d973dd15add0184e90d336c953bc;p=sigrok-cli.git decode: add sanity check when mapping channels We need to check for a valid channel_target pointer to handle the case when a user missed to provide a channel name. This fixes bug #1515. Signed-off-by: Wolfram Sang --- diff --git a/decode.c b/decode.c index 225162a..0bf1d25 100644 --- a/decode.c +++ b/decode.c @@ -271,6 +271,11 @@ static void map_pd_inst_channels(void *key, void *value, void *user_data) g_hash_table_iter_init(&iter, channel_map); while (g_hash_table_iter_next(&iter, &channel_id, &channel_target)) { + if (!channel_target) { + g_printerr("cli: Channel name for \"%s\" missing.\n", + (char *)channel_id); + continue; + } ch = find_channel(channel_list, channel_target); if (!ch) { g_printerr("cli: No channel with name \"%s\" found.\n",