From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Nassim Jahnke <jahnke.nassim@gmail.com>
Date: Tue, 28 Sep 2021 09:47:47 +0200
Subject: [PATCH] Ensure valid vehicle status


diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 1a2dd16ec1f189c3b53a57c0224a15f451b92501..f6410ba180a85b114a296c64ce293f0891f6b96c 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -503,7 +503,7 @@ public class ServerPlayer extends Player {
             }
         }
 
-        if (persistVehicle && entity1 != null && entity != this && entity.hasExactlyOnePlayerPassenger()) {
+        if (persistVehicle && entity1 != null && entity != this && entity.hasExactlyOnePlayerPassenger() && !entity.isRemoved()) { // Paper
             // CraftBukkit end
             CompoundTag nbttagcompound2 = new CompoundTag();
             CompoundTag nbttagcompound3 = new CompoundTag();
