Skip to content

Commit

Permalink
Fix an NPE in EntityGadget when draft_id isn't set
Browse files Browse the repository at this point in the history
Merge pull request Grasscutters#1579 from Hartie95/nullfix
  • Loading branch information
KingRainbow44 committed Jul 26, 2022
2 parents 107111d + 964e73f commit 9781d5e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/java/emu/grasscutter/game/entity/EntityGadget.java
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,12 @@ public SceneEntityInfo toProto() {
.setConfigId(this.getConfigId())
.setGadgetState(this.getState())
.setIsEnableInteract(true)
.setDraftId(this.metaGadget.draft_id)
.setAuthorityPeerId(this.getScene().getWorld().getHostPeerId());

if(this.metaGadget != null) {
gadgetInfo.setDraftId(this.metaGadget.draft_id);
}

if (this.getContent() != null) {
this.getContent().onBuildProto(gadgetInfo);
}
Expand Down

0 comments on commit 9781d5e

Please sign in to comment.