]> sigrok.org Git - sigrok-cli.git/blobdiff - decode.c
Show PD annotation row members by name, not number.
[sigrok-cli.git] / decode.c
index add16f744815e3c7fa6211af2a94590006beb3e1..7712ea10a2a2580df9e6297446581381f3f9c520 100644 (file)
--- a/decode.c
+++ b/decode.c
@@ -17,6 +17,8 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <stdlib.h>
+#include <string.h>
 #include "sigrok-cli.h"
 #include "config.h"
 #include <glib.h>
@@ -28,8 +30,6 @@ static GHashTable *pd_binary_visible = NULL;
 static GHashTable *pd_channel_maps = NULL;
 
 extern struct srd_session *srd_sess;
-extern gint opt_loglevel;
-
 
 static int opts_to_gvar(struct srd_decoder *dec, GHashTable *hash,
                GHashTable **options)
@@ -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)) {