Added ObjectService planet null check

Somewhere, someone is passing a null Planet object to createObject()
This commit is contained in:
Treeku
2014-06-16 20:28:57 +01:00
parent 90e762bc6e
commit 0a1322157b
+17 -1
View File
@@ -244,6 +244,18 @@ public class ObjectService implements INetworkDispatch {
else
isSnapshot = !overrideSnapshot;
if (planet == null) {
System.err.println("Planet is null in createObject for some reason.");
try {
throw new Exception();
} catch (Exception e) {
e.printStackTrace();
}
planet = core.terrainService.getPlanetByID(0);
}
if(Template.startsWith("object/creature")) {
object = new CreatureObject(objectID, planet, position, orientation, Template);
@@ -344,7 +356,11 @@ public class ObjectService implements INetworkDispatch {
return null;
}
object.setPlanetId(planet.getID());
if (planet != null) {
object.setPlanetId(planet.getID());
} else {
object.setPlanetId(0);
}
object.setAttachment("customServerTemplate", customServerTemplate);