Skip to content

Commit

Permalink
Fix NPE when link entity not found and use non-deprecated constructor (
Browse files Browse the repository at this point in the history
…GeyserMC#1706)

* Fix NPE when link entity not found and use non-deprecated constructor

* Extract method call to variable

* Update PlayerEntity.java

* Fix indentation
  • Loading branch information
rtm516 authored Jan 28, 2021
1 parent 462e9b8 commit 498f765
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,10 @@ public void spawnEntity(GeyserSession session) {

long linkedEntityId = session.getEntityCache().getCachedPlayerEntityLink(entityId);
if (linkedEntityId != -1) {
addPlayerPacket.getEntityLinks().add(new EntityLinkData(session.getEntityCache().getEntityByJavaId(linkedEntityId).getGeyserId(), geyserId, EntityLinkData.Type.RIDER, false));
Entity linkedEntity = session.getEntityCache().getEntityByJavaId(linkedEntityId);
if (linkedEntity != null) {
addPlayerPacket.getEntityLinks().add(new EntityLinkData(linkedEntity.getGeyserId(), geyserId, EntityLinkData.Type.RIDER, false, false));
}
}

valid = true;
Expand Down

0 comments on commit 498f765

Please sign in to comment.