mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-07-15 23:52:50 +00:00
protect save_map_bin and load_map_bin from possible lacking base
This commit is contained in:
parent
61720cec5e
commit
be27fc0fce
@ -808,6 +808,7 @@ bool save_map(const string& fname) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
EX void save_map_bin(hstream& f) {
|
EX void save_map_bin(hstream& f) {
|
||||||
|
if(!base) { f.write<short>(-1); return; }
|
||||||
auto& all = base->allcells();
|
auto& all = base->allcells();
|
||||||
int origcells = 0;
|
int origcells = 0;
|
||||||
for(cellinfo& ci: cells)
|
for(cellinfo& ci: cells)
|
||||||
@ -867,6 +868,7 @@ bool load_map(const string &fname) {
|
|||||||
EX void load_map_bin(hstream& f) {
|
EX void load_map_bin(hstream& f) {
|
||||||
auto& all = base->allcells();
|
auto& all = base->allcells();
|
||||||
eGeometry g = (eGeometry) f.get<short>();
|
eGeometry g = (eGeometry) f.get<short>();
|
||||||
|
if(int(g) == -1) return;
|
||||||
int sa = f.get<short>();
|
int sa = f.get<short>();
|
||||||
cellcount = f.get<short>();
|
cellcount = f.get<short>();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user