Skip to content

Commit ca0668e

Browse files
Added length check for default choices
1 parent 9ac4856 commit ca0668e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/java/net/javadiscord/javabot/systems/user_preferences/commands/PreferencesSetSubcommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public void handleAutoComplete(@NotNull CommandAutoCompleteInteractionEvent even
7272
String preferenceString = event.getOption("preference", OptionMapping::getAsString);
7373
if (preferenceString != null && Arrays.stream(Preference.values()).map(Preference::name).anyMatch(c -> c.equals(preferenceString))) {
7474
Preference preference = Preference.valueOf(preferenceString);
75-
if (preference.getType().getDefaultChoices() != null) {
75+
if (preference.getType().getDefaultChoices() != null && preference.getType().getDefaultChoices().length > 0) {
7676
event.replyChoices(AutoCompleteUtils.filterChoices(event, List.of(preference.getType().getDefaultChoices()))).queue();
7777
}
7878
}

0 commit comments

Comments
 (0)