Commit d7c9d57b authored by Michael Tremer's avatar Michael Tremer

country: Fix segmentation fault when continent code is not set

Signed-off-by: default avatarMichael Tremer <michael.tremer@ipfire.org>
parent 5adcc584
......@@ -159,8 +159,10 @@ int loc_country_to_database_v0(struct loc_country* country,
}
// Add continent code
for (unsigned int i = 0; i < 2; i++) {
dbobj->continent_code[i] = country->continent_code[i] ? country->continent_code[i] : '\0';
if (country->continent_code) {
for (unsigned int i = 0; i < 2; i++) {
dbobj->continent_code[i] = country->continent_code[i] ? country->continent_code[i] : '\0';
}
}
// Save the name string in the string pool
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment