summaryrefslogtreecommitdiffstats
path: root/src/World.cpp
diff options
context:
space:
mode:
authorLaG1924 <12997935+LaG1924@users.noreply.github.com>2020-07-31 07:05:46 +0200
committerGitHub <noreply@github.com>2020-07-31 07:05:46 +0200
commit28caa598e29b7eaa36d0877dd57947d29fe92e06 (patch)
tree14ce54f1349966ce3482d270c1b104bdac6cc86d /src/World.cpp
parentMerge pull request #42 from LaG1924/ftr/chat_component_parse (diff)
parentCorrected Game Start conditions (diff)
downloadAltCraft-28caa598e29b7eaa36d0877dd57947d29fe92e06.tar
AltCraft-28caa598e29b7eaa36d0877dd57947d29fe92e06.tar.gz
AltCraft-28caa598e29b7eaa36d0877dd57947d29fe92e06.tar.bz2
AltCraft-28caa598e29b7eaa36d0877dd57947d29fe92e06.tar.lz
AltCraft-28caa598e29b7eaa36d0877dd57947d29fe92e06.tar.xz
AltCraft-28caa598e29b7eaa36d0877dd57947d29fe92e06.tar.zst
AltCraft-28caa598e29b7eaa36d0877dd57947d29fe92e06.zip
Diffstat (limited to 'src/World.cpp')
-rw-r--r--src/World.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/World.cpp b/src/World.cpp
index d767871..c3246dc 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -378,7 +378,12 @@ void World::SetBlockId(Vector pos, BlockId block) {
std::floor(pos.y / 16.0),
std::floor(pos.z / 16.0));
Vector blockPos = pos - (sectionPos * 16);
- auto section = std::make_shared<Section>(*GetSectionPtr(sectionPos));
+ const Section* sectionPtr = GetSectionPtr(sectionPos);
+ if (!sectionPtr) {
+ LOG(ERROR) << "Updating unloaded chunk " << sectionPos;
+ return;
+ }
+ auto section = std::make_shared<Section>(*sectionPtr);
section->SetBlockId(blockPos, block);
sections[sectionPos] = section;
PUSH_EVENT("ChunkChanged",sectionPos);