Skip to content

Commit 56c3e1f

Browse files
committed
Improve LazyUtilities#sortChoicesFuzzy(...)
When input collection is empty
1 parent c875725 commit 56c3e1f

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/main/java/xyz/srnyx/lazylibrary/utility/LazyUtilities.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ public static boolean userHasChannelPermission(@NotNull Interaction interaction,
118118
*/
119119
@NotNull
120120
public static List<Command.Choice> sortChoicesFuzzy(@NotNull CommandAutoCompleteInteractionEvent event, @NotNull Collection<Command.Choice> collection) {
121+
if (collection.isEmpty()) return Collections.emptyList();
121122
final AutoCompleteQuery inputQuery = event.getFocusedOption();
122123
final OptionType type = inputQuery.getType();
123124
final String input = inputQuery.getValue().toLowerCase();

0 commit comments

Comments
 (0)