]> git.ipfire.org Git - location/libloc.git/blobdiff - src/python/database.c
python: database: Return None if no description/vendor/license set
[location/libloc.git] / 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);
 }