summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/main.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c
index c10657a..c5f8359 100644
--- a/src/main.c
+++ b/src/main.c
@@ -420,7 +420,12 @@ int main(int const argc, char *const *const argv) {
 			player_property(next_entities.player, "y", "64");
 			game_load_level("untitled");
 		} else {
-			game_load(file);
+			if (game_load(file)) {
+				fputs("the save file is corrupt!\n", stderr);
+				player_property(next_entities.player, "x", "40");
+				player_property(next_entities.player, "y", "64");
+				game_load_level("untitled");
+			}
 		}
 		#if 0
 		struct blob blob = res_get_map("untitled");
@@ -641,7 +646,10 @@ void main_loop(void) {
 						player_property(next_entities.player, "y", "64");
 						game_load_level("untitled");
 					} else {
-						game_load(file);
+						if (game_load(file)) {
+							fputs("the save file somehow corrupted itself!\n", stderr);
+							goto end; // better than freezing if the save file magically corrupts
+						}
 					}
 				}