From: Michael Tremer Date: Fri, 9 Sep 2022 14:21:42 +0000 (+0000) Subject: tests: country: Don't crash when a country could not be found X-Git-Tag: 0.9.15~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=766577bb2621856251f0f524de4a26afc75cb246;p=location%2Flibloc.git tests: country: Don't crash when a country could not be found Signed-off-by: Michael Tremer --- diff --git a/src/test-country.c b/src/test-country.c index 9820e8b..f9db204 100644 --- a/src/test-country.c +++ b/src/test-country.c @@ -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); }