From be27fc0fce24550ee8710653ca5d8f1011c02af2 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Sun, 24 Mar 2024 00:30:04 +0100 Subject: [PATCH] protect save_map_bin and load_map_bin from possible lacking base --- irregular.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/irregular.cpp b/irregular.cpp index 2007dabc..cfdeb02a 100644 --- a/irregular.cpp +++ b/irregular.cpp @@ -808,6 +808,7 @@ bool save_map(const string& fname) { } EX void save_map_bin(hstream& f) { + if(!base) { f.write(-1); return; } auto& all = base->allcells(); int origcells = 0; for(cellinfo& ci: cells) @@ -867,6 +868,7 @@ bool load_map(const string &fname) { EX void load_map_bin(hstream& f) { auto& all = base->allcells(); eGeometry g = (eGeometry) f.get(); + if(int(g) == -1) return; int sa = f.get(); cellcount = f.get();