Fix star null ptr

This commit is contained in:
Player Name 2026-06-10 08:58:36 +02:00
parent e343baeea1
commit d8697b762d
2 changed files with 16 additions and 7 deletions

View file

@ -63,11 +63,16 @@ class ShootingStar(var level: ShootingStarType = ShootingStarType.values().rando
"Lava Maze mining site" to Location.create(3062, 3885, 0), // Wilderness rune mine
"Mage Arena bank" to Location.create(3093, 3962, 0) // Mage Arena bank
)
val starSprite = NPC(8091)
var location = "Canifis Bank"
val loc = crash_locations[location]
val starSprite = let {
val npc = NPC(8091)
npc.location = loc
npc
}
var maxDust = level.totalStardust
var dustLeft = level.totalStardust
var starObject = Scenery(level.objectId, crash_locations.get(location))
var starObject = Scenery(level.objectId, loc)
var isDiscovered = false
var ticks = 0
var isSpawned = false

View file

@ -236,11 +236,15 @@ public abstract class Entity extends Node {
*/
public void clear() {
active = false;
if (this instanceof Player) {
location.getChunk().removePlayer(asPlayer());
}
if (this instanceof NPC) {
location.getChunk().remove(asNpc());
if (location == null) {
log(getClass(), Log.ERR, "Null location when clearing Entity " + getId());
} else {
if (this instanceof Player) {
location.getChunk().removePlayer(asPlayer());
}
if (this instanceof NPC) {
location.getChunk().remove(asNpc());
}
}
pulseManager.clear();
}