]> sigrok.org Git - libsigrokdecode.git/commitdiff
check before calling PyObject_GetAttrString(): this throws an exception.
authorBert Vermeulen <redacted>
Sat, 7 Jan 2012 02:42:26 +0000 (03:42 +0100)
committerBert Vermeulen <redacted>
Sat, 7 Jan 2012 02:42:26 +0000 (03:42 +0100)
decoder.c

index b5909168fec43b15528a1510ecc3d87eb750b9f2..f06d5e9e5a2efae5351c6af8fc695fd6fa2c4b11 100644 (file)
--- a/decoder.c
+++ b/decoder.c
@@ -134,7 +134,8 @@ int srd_load_decoder(const char *name, struct srd_decoder **dec)
 
        /* Convert class annotation attribute to GSList of **char */
        d->annotation = NULL;
-       if ((py_annlist = PyObject_GetAttrString(py_res, "annotation"))) {
+       if (PyObject_HasAttrString(py_res, "annotation")) {
+               py_annlist = PyObject_GetAttrString(py_res, "annotation");
                if (!PyList_Check(py_annlist)) {
                        srd_err("Protocol decoder module %s annotation should be a list", name);
                        return SRD_ERR_PYTHON;