Skip to content

Commit

Permalink
Prevent possible NPE during legacy file conversion (#5551)
Browse files Browse the repository at this point in the history
Co-authored-by: MD <1917406+mdcfe@users.noreply.github.com>
  • Loading branch information
JRoy and mdcfe authored Nov 11, 2023
1 parent 3eceec8 commit 50c4d04
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ public void setUsername(final String username) {

@Override
public boolean legacyFileExists() {
if (username == null) {
return false;
}
return new File(configFile.getParentFile(), username + ".yml").exists();
}

Expand All @@ -57,7 +60,7 @@ private File getAltFile() {

@Override
public boolean altFileExists() {
if (username.equals(username.toLowerCase())) {
if (username == null || username.equals(username.toLowerCase())) {
return false;
}
return getAltFile().exists();
Expand Down

0 comments on commit 50c4d04

Please sign in to comment.