]> git.ipfire.org Git - location/libloc.git/commitdiff
python: database: Return None if no description/vendor/license set
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 12 Aug 2022 15:37:32 +0000 (15:37 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 12 Aug 2022 15:37:32 +0000 (15:37 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/python/database.c

index ca56748c72443aa07e206016f86bec9b387be93d..a33c31f3621ceae2cbd40699015a77b9058f6062 100644 (file)
@@ -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);
 }