Commit Diff


commit - 373f08a56d950ffafd69d513541700d78a2f67bb
commit + 61d535c34a7df9951ab1b7904129149ed88ff149
blob - 5a40ba7e79d21c2038ec1aad6b877d1b89ed1dec
blob + 60b663970077c18d8253c46c7877df7076dc903f
--- fight.c
+++ fight.c
@@ -539,9 +539,13 @@ load_fight(int id)
 		if (id == json_object_get_int(lid)) {
 			log_debug("Loading fight for id: %d\n", json_object_get_int(lid));
 
-			curchar->fight->difficulty = json_object_get_int(json_object_object_get(temp, "difficulty"));
-			curchar->fight->progress   = json_object_get_double(json_object_object_get(temp, "progress"));
-			curchar->fight->initiative = json_object_get_int(json_object_object_get(temp, "initiative"));
+			json_object *cval;
+			json_object_object_get_ex(temp, "difficulty", &cval);
+			curchar->fight->difficulty = json_object_get_int(cval);
+			json_object_object_get_ex(temp, "progress", &cval);
+			curchar->fight->progress   = json_object_get_double(cval);
+			json_object_object_get_ex(temp, "initiative", &cval);
+			curchar->fight->initiative = json_object_get_int(cval);
 		}
 	}