Fix NPE when spectating a player without a camera entity

This commit is contained in:
Jonas Herzig
2017-05-21 11:51:19 +02:00
parent 60879fbbed
commit a34bbbcd68

View File

@@ -209,6 +209,9 @@ public class ReplayHandler {
*/
public void spectateEntity(Entity e) {
CameraEntity cameraEntity = getCameraEntity();
if (cameraEntity == null) {
return; // Cannot spectate if we have no camera
}
if (e == null || e == cameraEntity) {
spectating = null;
e = cameraEntity;