Skip to content

Commit

Permalink
Fix StackOverflow exception
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Mar 11, 2013
1 parent 65eafd0 commit 18eaf51
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/main/java/net/citizensnpcs/api/util/DataKey.java
Expand Up @@ -9,7 +9,7 @@

public abstract class DataKey {
protected final String path;
boolean database = this instanceof DatabaseKey;
private final boolean database = this instanceof DatabaseKey;

protected DataKey(String path) {
this.path = path;
Expand All @@ -24,15 +24,21 @@ protected String createRelativeKey(String from) {
return path.isEmpty() ? from : path + '.' + from;
}

private boolean transferring = false;

protected void transferOld(String key) {
if (database)
if (database || transferring)
return;
transferring = true;
String repl = key.replace("-", "");
if (!keyExists(repl))
if (!keyExists(repl)) {
transferring = false;
return;
}
Object value = getRaw(repl);
removeKey(repl);
setRaw(key, value);
transferring = false;
}

@Override
Expand Down

0 comments on commit 18eaf51

Please sign in to comment.