From: Michael Tremer Date: Fri, 12 Aug 2022 15:37:32 +0000 (+0000) Subject: python: database: Return None if no description/vendor/license set X-Git-Tag: 0.9.14~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f35adb4ce77add33769c6d81648ccebf1ed561a6;p=people%2Fms%2Flibloc.git python: database: Return None if no description/vendor/license set Signed-off-by: Michael Tremer --- diff --git a/src/python/database.c b/src/python/database.c index ca56748..a33c31f 100644 --- a/src/python/database.c +++ b/src/python/database.c @@ -103,18 +103,24 @@ static PyObject* Database_verify(DatabaseObject* self, PyObject* args) { static PyObject* Database_get_description(DatabaseObject* self) { const char* description = loc_database_get_description(self->db); + if (!description) + Py_RETURN_NONE; return PyUnicode_FromString(description); } static PyObject* Database_get_vendor(DatabaseObject* self) { const char* vendor = loc_database_get_vendor(self->db); + if (!vendor) + Py_RETURN_NONE; return PyUnicode_FromString(vendor); } static PyObject* Database_get_license(DatabaseObject* self) { const char* license = loc_database_get_license(self->db); + if (!license) + Py_RETURN_NONE; return PyUnicode_FromString(license); }