]> git.ipfire.org Git - people/ms/ipfire-2.x.git/commitdiff
freifunk.cgi: Catch JSON parsing errors and move on
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 8 Mar 2015 16:38:00 +0000 (17:38 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 9 Mar 2015 11:19:40 +0000 (12:19 +0100)
html/cgi-bin/freifunk.cgi

index a9b9d6ae3298e59d5bafe2e05edb1c96520915aa..1ee22d802db9e297b02181455c4f819e00f1e641 100755 (executable)
@@ -355,7 +355,12 @@ sub LoadNetwork() {
        my $file = shift;
 
        if (-e $file) {
-               return JSON::Parse::json_file_to_perl($file);
+               my $ret = eval {
+                       return JSON::Parse::json_file_to_perl($file);
+               } or do {
+                       return undef;
+               };
+               return $ret;
        }
 
        return undef;