From 3409dfb8212a838f92d3cb388d7d6478f80ed2a8 Mon Sep 17 00:00:00 2001 From: Fireblade <72758695+Firebladedoge229@users.noreply.github.com> Date: Mon, 25 May 2026 21:29:59 -0400 Subject: [PATCH] fix: misc crashes --- Minecraft.World/CompoundTag.h | 15 +++++++++++++-- Minecraft.World/RedStoneDustTile.cpp | 3 ++- Minecraft.World/SlimeTile.cpp | 1 - 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Minecraft.World/CompoundTag.h b/Minecraft.World/CompoundTag.h index 83d0bfb2..82020970 100644 --- a/Minecraft.World/CompoundTag.h +++ b/Minecraft.World/CompoundTag.h @@ -205,8 +205,19 @@ public: wstring getString(const wstring &name) { - if (tags.find(name) == tags.end()) return wstring( L"" ); - return static_cast(tags[name])->data; + auto it = tags.find(name); + + if (it == tags.end()) + return L""; + + Tag* tag = it->second; + + if (!tag || tag->getId() != Tag::TAG_STRING) + return L""; + + StringTag* stringTag = static_cast(tag); + + return stringTag->data; } byteArray getByteArray(const wstring &name) diff --git a/Minecraft.World/RedStoneDustTile.cpp b/Minecraft.World/RedStoneDustTile.cpp index 2e168e6a..d849d77b 100644 --- a/Minecraft.World/RedStoneDustTile.cpp +++ b/Minecraft.World/RedStoneDustTile.cpp @@ -383,12 +383,13 @@ bool RedStoneDustTile::shouldConnectTo(LevelSource *level, int x, int y, int z, int t = level->getTile(x, y, z); if (t == Tile::redstone_wire_Id) return true; if (t == 0) return false; + Tile *tile = Tile::tiles[t]; if (Tile::unpowered_repeater->isSameDiode(t)) { int data = level->getData(x, y, z); return direction == (data & DiodeTile::DIRECTION_MASK) || direction == Direction::DIRECTION_OPPOSITE[data & DiodeTile::DIRECTION_MASK]; } - else if (Tile::tiles[t]->isSignalSource() && direction != Direction::UNDEFINED) return true; + else if (tile != nullptr && tile->isSignalSource() && direction != Direction::UNDEFINED) return true; return false; } diff --git a/Minecraft.World/SlimeTile.cpp b/Minecraft.World/SlimeTile.cpp index 400fc730..5881c4a2 100644 --- a/Minecraft.World/SlimeTile.cpp +++ b/Minecraft.World/SlimeTile.cpp @@ -48,7 +48,6 @@ void SlimeTile::fallOn(Level *level, int x, int y, int z, entity->clearFallDamageQueue(); entity->fallDistance = 0.0f; - entity->onGround = false; if (entity->isSneaking()) return;