make sure towerData is not null (#1240)

* make sure towerData is not null

* Update Player.java

* add notice
This commit is contained in:
zhaodice 2022-06-11 19:34:25 +08:00 committed by GitHub
parent ef9d96b6d8
commit 7126b1569e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -191,6 +191,7 @@ public class Player {
this.nameCardList = new HashSet<>(); this.nameCardList = new HashSet<>();
this.flyCloakList = new HashSet<>(); this.flyCloakList = new HashSet<>();
this.costumeList = new HashSet<>(); this.costumeList = new HashSet<>();
this.towerData = new TowerData();
this.unlockedForgingBlueprints = new HashSet<>(); this.unlockedForgingBlueprints = new HashSet<>();
this.activeForges = new ArrayList<>(); this.activeForges = new ArrayList<>();
@ -483,6 +484,10 @@ public class Player {
} }
public TowerData getTowerData() { public TowerData getTowerData() {
if(towerData==null){
// because of mistake, null may be saved as storage at some machine, this if can be removed in future
towerData = new TowerData();
}
return towerData; return towerData;
} }