From f35adb4ce77add33769c6d81648ccebf1ed561a6 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Fri, 12 Aug 2022 15:37:32 +0000 Subject: [PATCH] python: database: Return None if no description/vendor/license set Signed-off-by: Michael Tremer --- src/python/database.c | 6 ++++++ 1 file changed, 6 insertions(+) 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); } -- 2.39.5