Skip to content

Commit 8fd5d69

Browse files
committed
fix: add judgement in getEnderChest
1 parent a9e39a1 commit 8fd5d69

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/legacy/api/PlayerAPI.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1612,8 +1612,11 @@ Local<Value> PlayerClass::getEnderChest(const Arguments& args) {
16121612
try {
16131613
Player* player = get();
16141614
if (!player) return Local<Value>();
1615-
1616-
return ContainerClass::newContainer(player->getEnderChestContainer());
1615+
if (player->getEnderChestContainer().has_value()) {
1616+
return ContainerClass::newContainer(player->getEnderChestContainer());
1617+
} else {
1618+
return {};
1619+
}
16171620
}
16181621
CATCH("Fail in getEnderChest!");
16191622
}

0 commit comments

Comments
 (0)