Skip to content

Commit

Permalink
Validate state
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Jan 17, 2019
1 parent 71b8744 commit 5447561
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions main/src/main/java/net/citizensnpcs/Citizens.java
Expand Up @@ -381,9 +381,14 @@ public void run() {

@Override
public void setDefaultNPCDataStore(NPCDataStore store) {
saves.storeAll(npcRegistry);
saves.saveToDiskImmediate();
despawnNPCs();
if (store == null) {
throw new IllegalArgumentException("must be non-null");
}
if (saves != null) {
saves.storeAll(npcRegistry);
saves.saveToDiskImmediate();
despawnNPCs();
}
this.saves = store;
this.npcRegistry = new CitizensNPCRegistry(saves);
}
Expand Down

0 comments on commit 5447561

Please sign in to comment.