summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUwe Hermann <uwe@hermann-uwe.de>2013-10-23 19:23:40 +0200
committerUwe Hermann <uwe@hermann-uwe.de>2013-10-24 15:22:16 +0200
commit3af0e3455d4263f79920afaf6aed44286ad37ba0 (patch)
tree7bb1c7f1ed0f9b0933c04d012010556db1650c5b
parent368b406efb2f4527d11b10dda8011f352288023e (diff)
downloadlibsigrokdecode-3af0e3455d4263f79920afaf6aed44286ad37ba0.tar.gz
libsigrokdecode-3af0e3455d4263f79920afaf6aed44286ad37ba0.zip
controller.c: Add checks for srd_inst_option_set().
This also fixes some unit tests that were previously failing.
-rw-r--r--controller.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/controller.c b/controller.c
index 635e47e..ebb9f3a 100644
--- a/controller.c
+++ b/controller.c
@@ -305,6 +305,16 @@ SRD_API int srd_inst_option_set(struct srd_decoder_inst *di,
const char *val_str;
char *dbg, *key;
+ if (!di) {
+ srd_err("Invalid decoder instance.");
+ return SRD_ERR_ARG;
+ }
+
+ if (!options) {
+ srd_err("Invalid options GHashTable.");
+ return SRD_ERR_ARG;
+ }
+
if (!PyObject_HasAttrString(di->decoder->py_dec, "options")) {
/* Decoder has no options. */
if (g_hash_table_size(options) == 0) {