World object null checks.

This commit is contained in:
MobiusDevelopment
2020-09-04 18:50:00 +00:00
parent f8411b953e
commit 0ec7e382dd
38 changed files with 321 additions and 78 deletions

View File

@@ -413,7 +413,7 @@ public class World
for (int j = 0; j < visibleObjects.size(); j++)
{
final WorldObject wo = visibleObjects.get(j);
if (wo == object)
if ((wo == null) || (wo == object))
{
continue;
}
@@ -482,7 +482,7 @@ public class World
for (int j = 0; j < visibleObjects.size(); j++)
{
final WorldObject wo = visibleObjects.get(j);
if (wo == object)
if ((wo == null) || (wo == object))
{
continue;
}
@@ -542,7 +542,7 @@ public class World
for (int j = 0; j < visibleObjects.size(); j++)
{
final WorldObject wo = visibleObjects.get(j);
if ((wo == object) || (wo.getInstanceWorld() != object.getInstanceWorld()))
if ((wo == null) || (wo == object) || (wo.getInstanceWorld() != object.getInstanceWorld()))
{
continue;
}

View File

@@ -55,6 +55,11 @@ public class WorldRegion
for (int i = 0; i < _visibleObjects.size(); i++)
{
final WorldObject wo = _visibleObjects.get(i);
if (wo == null)
{
continue;
}
if (wo.isAttackable())
{
final Attackable mob = (Attackable) wo;
@@ -91,6 +96,11 @@ public class WorldRegion
for (int i = 0; i < _visibleObjects.size(); i++)
{
final WorldObject wo = _visibleObjects.get(i);
if (wo == null)
{
continue;
}
if (wo.isAttackable())
{
// Start HP/MP/CP regeneration task.
@@ -120,7 +130,8 @@ public class WorldRegion
final List<WorldObject> regionObjects = worldRegion.getVisibleObjects();
for (int j = 0; j < regionObjects.size(); j++)
{
if (regionObjects.get(j).isPlayable())
final WorldObject wo = regionObjects.get(j);
if ((wo != null) && wo.isPlayable())
{
return false;
}