summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBert Vermeulen <bert@biot.com>2012-01-18 22:59:14 +0100
committerBert Vermeulen <bert@biot.com>2012-01-18 22:59:14 +0100
commite431d9cc4afa5e695efea61fb769f20d86f0bbe0 (patch)
tree3d3126550c73061a8732f81120faa90186f6c2d9
parent79c4f9b987329587fd388d49015921ab4f9553bd (diff)
downloadlibsigrokdecode-e431d9cc4afa5e695efea61fb769f20d86f0bbe0.tar.gz
libsigrokdecode-e431d9cc4afa5e695efea61fb769f20d86f0bbe0.zip
srd: always set default options, regardless of overrides
-rw-r--r--controller.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/controller.c b/controller.c
index 6bb7748..4fa729c 100644
--- a/controller.c
+++ b/controller.c
@@ -146,13 +146,17 @@ int srd_instance_set_options(struct srd_decoder_instance *di,
int num_optkeys, ret, size, i;
char *key, *value;
- if (g_hash_table_size(options) == 0)
- /* No options provided. */
- return SRD_OK;
-
- if(!PyObject_HasAttrString(di->decoder->py_dec, "options"))
+ if(!PyObject_HasAttrString(di->decoder->py_dec, "options")) {
/* Decoder has no options. */
+ if (g_hash_table_size(options) == 0) {
+ /* No options provided. */
+ return SRD_OK;
+ } else {
+ srd_err("Protocol decoder has no options.");
+ return SRD_ERR_ARG;
+ }
return SRD_OK;
+ }
ret = SRD_ERR_PYTHON;
key = NULL;