]> Pileus Git - ~andy/rhawk/commitdiff
Fix loading empty game
authorAndy Spencer <andy753421@gmail.com>
Mon, 6 May 2013 04:32:39 +0000 (04:32 +0000)
committerAndy Spencer <andy753421@gmail.com>
Mon, 6 May 2013 05:37:23 +0000 (05:37 +0000)
json.awk
spades.awk

index 6408253a49ce0273620edca1d2e3a0869855721c..5a22942ea56b026976c1c115b426f8d5e618e451 100644 (file)
--- a/json.awk
+++ b/json.awk
@@ -262,6 +262,7 @@ function json_load(file, var,   line, text, tokens, data, key)
                return data[0]
        for (key in data[0])
                json_copy(var, key, data[0][key])
+       return 1
 }
 
 function json_save(file, var,   cmd, tmp)
index 60b4c025a1278e88e516a90f241c2dec4a7d3145..ae662ca217b6752d13b47c2391afd99a328a6845 100644 (file)
@@ -102,7 +102,8 @@ function sp_save(file,      game)
 function sp_load(file, game)
 {
        # Load
-       json_load(file, game);
+       if (!json_load(file, game))
+               return
 
        # Per hand
        sp_suit    = game["suit"];