]> sigrok.org Git - sigrok-cli.git/commitdiff
Check srd_decoder_get_by_id() output.
authorBert Vermeulen <redacted>
Fri, 20 Jun 2014 15:01:48 +0000 (17:01 +0200)
committerBert Vermeulen <redacted>
Fri, 20 Jun 2014 15:01:48 +0000 (17:01 +0200)
This fixes bug 370. Thanks to Sander Alberink for the bug report
and patch.

decode.c

index add16f744815e3c7fa6211af2a94590006beb3e1..830882d351a107dcb1e2c81597921d3e0e8d180a 100644 (file)
--- a/decode.c
+++ b/decode.c
@@ -142,7 +142,11 @@ int register_pds(const char *opt_pds, char *opt_pd_annotations)
                        ret = 1;
                        break;
                }
-               dec = srd_decoder_get_by_id(pd_name);
+               if (!(dec = srd_decoder_get_by_id(pd_name))) {
+                       g_critical("Failed to get decoder %s by id.", pd_name);
+                       ret = 1;
+                       break;
+               }
 
                /* Convert decoder option and channel values to GVariant. */
                if (!opts_to_gvar(dec, pd_opthash, &options)) {