Fix NPE when spectated non-player entity despawns (fixes #94)
This commit is contained in:
@@ -160,6 +160,11 @@ public class CameraEntity extends EntityPlayerSP {
|
|||||||
if (spectating != null && (view.getUniqueID() != spectating
|
if (spectating != null && (view.getUniqueID() != spectating
|
||||||
|| view.worldObj != worldObj)
|
|| view.worldObj != worldObj)
|
||||||
|| worldObj.getEntityByID(view.getEntityId()) != view) {
|
|| worldObj.getEntityByID(view.getEntityId()) != view) {
|
||||||
|
if (spectating == null) {
|
||||||
|
// Entity (non-player) died, stop spectating
|
||||||
|
ReplayModReplay.instance.getReplayHandler().spectateEntity(this);
|
||||||
|
return;
|
||||||
|
}
|
||||||
view = worldObj.getPlayerEntityByUUID(spectating);
|
view = worldObj.getPlayerEntityByUUID(spectating);
|
||||||
if (view != null) {
|
if (view != null) {
|
||||||
mc.setRenderViewEntity(view);
|
mc.setRenderViewEntity(view);
|
||||||
|
|||||||
Reference in New Issue
Block a user