diff options
-rw-r--r-- | src/World.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/World.cpp b/src/World.cpp index 7982924ae..04eab1851 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -1585,6 +1585,12 @@ void cWorld::SpawnItemPickups(const cItems & a_Pickups, double a_BlockX, double a_FlyAwaySpeed /= 1000; // Pre-divide, so that we don't have to divide each time inside the loop for (cItems::const_iterator itr = a_Pickups.begin(); itr != a_Pickups.end(); ++itr) { + if (!IsValidItem(itr->m_ItemType)) + { + // Don't spawn pickup if item isn't even valid; should prevent client crashing too + continue; + } + float SpeedX = (float)(a_FlyAwaySpeed * (r1.randInt(1000) - 500)); float SpeedY = (float)(a_FlyAwaySpeed * (r1.randInt(1000) - 500)); float SpeedZ = (float)(a_FlyAwaySpeed * (r1.randInt(1000) - 500)); @@ -1605,6 +1611,11 @@ void cWorld::SpawnItemPickups(const cItems & a_Pickups, double a_BlockX, double { for (cItems::const_iterator itr = a_Pickups.begin(); itr != a_Pickups.end(); ++itr) { + if (!IsValidItem(itr->m_ItemType)) + { + continue; + } + cPickup * Pickup = new cPickup( a_BlockX, a_BlockY, a_BlockZ, *itr, IsPlayerCreated, (float)a_SpeedX, (float)a_SpeedY, (float)a_SpeedZ |