diff options
-rw-r--r-- | src/game-server/mapcomposite.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/game-server/mapcomposite.cpp b/src/game-server/mapcomposite.cpp index deb43b4e..41073b3c 100644 --- a/src/game-server/mapcomposite.cpp +++ b/src/game-server/mapcomposite.cpp @@ -403,12 +403,16 @@ void MapContent::deallocate(Entity *obj) */ Entity *MapContent::findEntityById(int publicId) const { + if (publicId < 0) { + return nullptr; + } + if (ObjectBucket *b = buckets[publicId / 256]) { const int bucketIndex = publicId % 256; if (b->isAllocated(bucketIndex)) return b->objects[bucketIndex]; } - return 0; + return nullptr; } static void addZone(MapRegion &r, unsigned z) |