Skip to content

Commit 095d091

Browse files
Added null-check for currentRoleAndXp
1 parent 6a7f285 commit 095d091

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/main/java/net/javadiscord/javabot/systems/help/commands/subcommands/HelpAccountSubcommand.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,10 @@ private String formatExperience(Guild guild, HelpAccount account) {
7979
double goalXp = nextRoleAndXp.second() - account.getLastExperienceGoal(guild);
8080
StringBuilder sb = new StringBuilder();
8181

82-
// Show the current experience level on the first line.
83-
sb.append(String.format("%s\n", currentRoleAndXp.first().getAsMention()));
84-
82+
if (currentRoleAndXp.first() != null) {
83+
// Show the current experience level on the first line.
84+
sb.append(String.format("%s\n", currentRoleAndXp.first().getAsMention()));
85+
}
8586
// Below, show the progress to the next level, or just the XP if they've reached the max level.
8687
if (goalXp > 0) {
8788
double percentToGoalXp = (currentXp / goalXp) * 100.0;

0 commit comments

Comments
 (0)