From 2d661bcb259dedee1857e90749418ce72f571ba6 Mon Sep 17 00:00:00 2001 From: Uwe Hermann Date: Wed, 16 May 2018 00:21:56 +0200 Subject: [PATCH] decoder.c: Fix a scan-build warning. decoder.c:343:9: warning: Access to field 'ob_type' results in a dereference of a null pointer (loaded from variable 'py_default') if (Py_TYPE(py_default) != Py_TYPE(py_item)) { ^~~~~~~~~~~~~~~~~~~ /usr/include/python3.6m/object.h:118:33: note: expanded from macro 'Py_TYPE' #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ --- decoder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/decoder.c b/decoder.c index 21b756b..bebe96c 100644 --- a/decoder.c +++ b/decoder.c @@ -340,7 +340,7 @@ static int get_options(struct srd_decoder *d) if (!py_item) goto except_out; - if (Py_TYPE(py_default) != Py_TYPE(py_item)) { + if (py_default && (Py_TYPE(py_default) != Py_TYPE(py_item))) { srd_err("All values for option '%s' must be " "of the same type as the default.", o->id); -- 2.30.2