ossobv / asterisklint

Asterisk PBX configuration syntax checker
GNU General Public License v3.0
61 stars 12 forks source link

walk_jump_destinations: UnboundLocalError: local variable 'i' referenced before assignment #7

Closed wdoekes closed 8 years ago

wdoekes commented 8 years ago
walter@walter-dev:0:~/asterisklint$ ./scripts/asterisklint dialplan-check bug.conf 
bug.conf:0 H_DP_GENERAL_MISPLACED: [general] context not found or not at top of file
bug.conf:0 H_DP_GLOBALS_MISPLACED: [globals] context not found or not at position two
Traceback (most recent call last):
  File "./scripts/asterisklint", line 34, in <module>
    sys.exit(main(sys.argv[1:], os.environ))
  File "/home/walter/asterisklint/asterisklint/main.py", line 147, in main
    return command_module.main(args, envs)
  File "/home/walter/asterisklint/asterisklint/commands/dialplan-check.py", line 49, in main
    dialplan.walk_jump_destinations()
  File "/home/walter/asterisklint/asterisklint/dialplan.py", line 181, in walk_jump_destinations
    extension, priority)
  File "/home/walter/asterisklint/asterisklint/dialplan.py", line 281, in match_pattern
    if pattern.matches_extension(extension):
  File "/home/walter/asterisklint/asterisklint/pattern.py", line 375, in matches_extension
    value = self.values[i + 2]
UnboundLocalError: local variable 'i' referenced before assignment
walter@walter-dev:1:~/asterisklint$ cat bug.conf 
[context]
exten => s,1,GotoIf($["${CALLERID(num):0:1}"="+"]?${EXTEN:1},1) ; strip + if it is there