diff options
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/main.cpp b/src/main.cpp index 8a9d14d0a..bb2ac5faf 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1296,9 +1296,13 @@ int main(int argc, char *argv[]) new_db->beginSave(); for (std::list<v3s16>::iterator i = blocks.begin(); i != blocks.end(); i++) { MapBlock *block = old_map.loadBlock(*i); - new_db->saveBlock(block); - MapSector *sector = old_map.getSectorNoGenerate(v2s16(i->X, i->Z)); - sector->deleteBlock(block); + if (!block) { + errorstream << "Failed to load block " << PP(*i) << ", skipping it."; + } else { + old_map.saveBlock(block, new_db); + MapSector *sector = old_map.getSectorNoGenerate(v2s16(i->X, i->Z)); + sector->deleteBlock(block); + } ++count; if (count % 500 == 0) actionstream << "Migrated " << count << " blocks " @@ -1947,4 +1951,3 @@ int main(int argc, char *argv[]) } //END - |