Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
}
LOC_EXPORT const char* loc_country_get_continent_code(struct loc_country* country) {
+ if (!*country->continent_code)
+ return NULL;
+
return country->continent_code;
}
static PyObject* Country_get_name(CountryObject* self) {
const char* name = loc_country_get_name(self->country);
+ // Return None if no name has been set
+ if (!name)
+ Py_RETURN_NONE;
+
return PyUnicode_FromString(name);
}
static PyObject* Country_get_continent_code(CountryObject* self) {
const char* code = loc_country_get_continent_code(self->country);
+ if (!code)
+ Py_RETURN_NONE;
+
return PyUnicode_FromString(code);
}