增加礼物列表容错处理

main
grimm 2025-10-14 18:56:13 +08:00
parent 2a683bc8f3
commit c03c7e525f
1 changed files with 6 additions and 1 deletions

View File

@ -127,7 +127,6 @@ public class Hero extends MongoBase implements Cloneable, Serializable {
combatPlanMap = new HashMap<>(2); combatPlanMap = new HashMap<>(2);
medalMap = new HashMap<>(4); medalMap = new HashMap<>(4);
this.adjustByPositionMap = hero.adjustByPositionMap; this.adjustByPositionMap = hero.adjustByPositionMap;
this.heroGiftEquipList = new HashSet<>(hero.getHeroGiftEquipList());
} }
public Hero(int uid, int heroTid, int initStar) { public Hero(int uid, int heroTid, int initStar) {
@ -661,6 +660,9 @@ public class Hero extends MongoBase implements Cloneable, Serializable {
} }
public void setHeroGiftEquipList(Set<Integer> heroGiftEquipList) { public void setHeroGiftEquipList(Set<Integer> heroGiftEquipList) {
if(heroGiftEquipList == null){
heroGiftEquipList = new HashSet<>();
}
this.heroGiftEquipList = heroGiftEquipList; this.heroGiftEquipList = heroGiftEquipList;
updateString("heroGiftEquipList", heroGiftEquipList); updateString("heroGiftEquipList", heroGiftEquipList);
} }
@ -671,6 +673,9 @@ public class Hero extends MongoBase implements Cloneable, Serializable {
} }
public Set<Integer> getHeroGiftEquipList() { public Set<Integer> getHeroGiftEquipList() {
if(this.heroGiftEquipList == null){
this.heroGiftEquipList = new HashSet<>();
}
return heroGiftEquipList; return heroGiftEquipList;
} }
} }