diff --git a/src/main/java/com/matthewprenger/helpfixer/HelpFixer.java b/src/main/java/com/matthewprenger/helpfixer/HelpFixer.java index 449ffa7..2808092 100755 --- a/src/main/java/com/matthewprenger/helpfixer/HelpFixer.java +++ b/src/main/java/com/matthewprenger/helpfixer/HelpFixer.java @@ -9,6 +9,7 @@ import javax.annotation.Nonnull; import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; import net.minecraft.command.CommandHelp; import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; @@ -41,16 +42,25 @@ protected List getSortedPossibleCommands(ICommandSender sender) { Iterator iterator = list.iterator(); while (iterator.hasNext()) { ICommand command = iterator.next(); - if (command.getCommandName() == null) { + try { + if (command.getCommandName() == null) { + FMLLog.warning( + String.format( + "[HelpFixer] Identified command with null name, Ignoring: %s", + command.getClass().getName())); + iterator.remove(); + } else if (command.getCommandUsage(sender) == null) { + FMLLog.warning( + String.format( + "[HelpFixer] Identified command with null usage, Ignoring: %s", + command.getClass().getName())); + iterator.remove(); + } + } catch (CommandException commandException) { FMLLog.warning( String.format( - "[HelpFixer] Identified command with null name, Ignoring: %s", - command.getClass().getName())); - iterator.remove(); - } else if (command.getCommandUsage(sender) == null) { - FMLLog.warning( - String.format( - "[HelpFixer] Identified command with null usage, Ignoring: %s", + "[HelpFixer] Command to throw exception %s, Ignoring: %s", + commandException.getClass().getName(), command.getClass().getName())); iterator.remove(); }