fix: manually boxing for targetable boolean state to prevent NPE (#3174)

* fix: manually boxing for comparison is necessary as the targetable state may undefined

* chore: remove unused import
This commit is contained in:
ZX夏夜之风 2024-11-02 13:15:08 +08:00 committed by GitHub
parent 7f400dc672
commit 969d5cd396
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -67,7 +67,7 @@ public class TargetableTrait extends Trait {
}
public void setTargetable(boolean targetable) {
if (this.targetable == targetable)
if (Boolean.valueOf(targetable).equals(this.targetable))
return;
this.targetable = targetable;
if (!targetable) {