]> sigrok.org Git - sigrok-cli.git/commitdiff
decode: add sanity check when mapping channels
authorWolfram Sang <redacted>
Tue, 7 Apr 2020 22:31:32 +0000 (00:31 +0200)
committerUwe Hermann <redacted>
Sat, 11 Apr 2020 14:25:11 +0000 (16:25 +0200)
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 <redacted>
decode.c

index 225162a45e4cde1238da788ec4e5c8754bd91f93..0bf1d250bacb2063f5d28738a72083fd5db13b5c 100644 (file)
--- 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",