]> git.ipfire.org Git - location/libloc.git/commitdiff
tests: country: Don't crash when a country could not be found
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 9 Sep 2022 14:21:42 +0000 (14:21 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 9 Sep 2022 14:21:42 +0000 (14:21 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/test-country.c

index 9820e8b0f187ce0d38df2ea082da4c2c39032879..f9db204c2a6183dc80d575ad5f727f2f2b199def 100644 (file)
@@ -145,7 +145,7 @@ int main(int argc, char** argv) {
 
        // Lookup an address in the subnet
        err = loc_database_get_country(db, &country, "YY");
-       if (err) {
+       if (err || !country) {
                fprintf(stderr, "Could not find country: YY\n");
                exit(EXIT_FAILURE);
        }