Fix NPE when spectated non-player entity despawns (fixes #94)

This commit is contained in:
Jonas Herzig
2017-08-28 10:58:04 +02:00
parent b27af2781b
commit adfe6a2bfc

View File

@@ -160,6 +160,11 @@ public class CameraEntity extends EntityPlayerSP {
if (spectating != null && (view.getUniqueID() != spectating
|| view.worldObj != worldObj)
|| worldObj.getEntityByID(view.getEntityId()) != view) {
if (spectating == null) {
// Entity (non-player) died, stop spectating
ReplayModReplay.instance.getReplayHandler().spectateEntity(this);
return;
}
view = worldObj.getPlayerEntityByUUID(spectating);
if (view != null) {
mc.setRenderViewEntity(view);