Skip to content

Commit

Permalink
fix: infinite loops
Browse files Browse the repository at this point in the history
  • Loading branch information
LupusVirtute committed Nov 5, 2022
1 parent 0b69ba4 commit 87a5697
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/java/org/lupus/commands/core/data/CommandBuilder.kt
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ open class CommandBuilder(
}

val argumentType = ArgumentTypeList[clazz]
?: throw IllegalArgumentException("clazz argument isn't in ArgumentTypes list")
?: throw IllegalArgumentException("$clazz argument isn't in ArgumentTypes list https://github.com/LupusVirtute/LupusCMDFramework/wiki/Clazz-argument-isn't-in-ArgumentTypes-List")

if (argumentType.argumentSpan > 1) {
val argumentNames = argumentType.argumentName.split(',')
Expand Down Expand Up @@ -204,6 +204,7 @@ open class CommandBuilder(

fun addSubCommandPass(pass: String) {
val subCommand = pluginClazzLoader.loadClass(pass) ?: return
if (subCommand == declaringClazz) throw Error("Infinite loop detected https://github.com/LupusVirtute/LupusCMDFramework/wiki/Infinite-Loops")
val cmd = ClazzScanner(plugin, packageName).scan(subCommand,true) ?: return
cmd.supCommand = this
this.subCommands.add(cmd)
Expand Down

0 comments on commit 87a5697

Please sign in to comment.