]> git.ipfire.org Git - people/ms/libloc.git/commitdiff
perl: Return NULL when no country code was found
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 28 Sep 2019 16:20:56 +0000 (16:20 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 28 Sep 2019 16:20:56 +0000 (16:20 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/perl/Location/Location.xs

index 391dcb14ba2f1e4cec390afa694599ebd9724328..c45e9140003f90ca1baf89d06b2889b66e07758f 100644 (file)
@@ -73,11 +73,11 @@ get_country_code(db, address)
                const char* country_code = loc_network_get_country_code(network);
                loc_network_unref(network);
 
-               if (!country_code) {
-                       croak("Could not get the country code for %s\n", address);
+               if (country_code) {
+                       RETVAL = strdup(country_code);
+               } else {
+                       RETVAL = NULL;
                }
-
-               RETVAL = strdup(country_code);
        OUTPUT:
                RETVAL