diff --git a/src/Resource/Biome.cpp b/src/Resource/Biome.cpp index de56e74..b5bf2df 100644 --- a/src/Resource/Biome.cpp +++ b/src/Resource/Biome.cpp @@ -1,5 +1,6 @@ /* Copyright (c) 2015, 2018, Matthias Schiffer + Copyright (c) 2019, Roman Shishkin All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/src/World/Chunk.cpp b/src/World/Chunk.cpp index 50ac81e..7af7923 100644 --- a/src/World/Chunk.cpp +++ b/src/World/Chunk.cpp @@ -1,5 +1,6 @@ /* Copyright (c) 2015-2018, Matthias Schiffer + Copyright (c) 2019, Roman Shishkin All rights reserved. Redistribution and use in source and binary forms, with or without @@ -54,9 +55,11 @@ Chunk::Chunk(const ChunkData *data) { for (auto &sTag : *sectionsTag) { auto s = std::dynamic_pointer_cast(sTag); std::unique_ptr
section = Section::makeSection(s); - size_t Y = section->getY(); - sections.resize(Y); - sections.push_back(std::move(section)); + if (section != nullptr) { + size_t Y = section->getY(); + sections.resize(Y); + sections.push_back(std::move(section)); + } } } diff --git a/src/World/Section.cpp b/src/World/Section.cpp index fbf1c33..d4cc0e2 100644 --- a/src/World/Section.cpp +++ b/src/World/Section.cpp @@ -1,5 +1,6 @@ /* Copyright (c) 2015-2018, Matthias Schiffer + Copyright (c) 2019, Roman Shishkin All rights reserved. Redistribution and use in source and binary forms, with or without @@ -49,10 +50,14 @@ std::unique_ptr
Section::makeSection(const std::shared_ptr(new PaletteSection(section, std::move(blockStates), palette)); } - std::shared_ptr blocks = assertValue(section->get("Blocks")); - std::shared_ptr data = assertValue(section->get("Data")); + std::shared_ptr blocks = section->get("BlockStates"); + if (blocks) { + std::shared_ptr data = assertValue(section->get("Data")); - return std::unique_ptr
(new LegacySection(section, std::move(blocks), std::move(data))); + return std::unique_ptr
(new LegacySection(section, std::move(blocks), std::move(data))); + } + + return nullptr; }