controller.c: Add checks for srd_inst_option_set().
authorUwe Hermann <uwe@hermann-uwe.de>
Wed, 23 Oct 2013 17:23:40 +0000 (19:23 +0200)
committerUwe Hermann <uwe@hermann-uwe.de>
Thu, 24 Oct 2013 13:22:16 +0000 (15:22 +0200)
This also fixes some unit tests that were previously failing.

controller.c

index 635e47e6eae41aef5904213721eb501da50b1597..ebb9f3adb768df970da9d886b882e2df01fb950d 100644 (file)
@@ -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) {