Fixed a possible index error in the yang validator checker plugin.

- Legacy-Id: 10952
This commit is contained in:
Henrik Levkowetz 2016-03-17 13:22:16 +00:00
parent 75a3895dd9
commit e0d1c0b313

View file

@ -140,7 +140,10 @@ class DraftYangChecker(object):
for line in error_lines:
fn, lnum, msg = line.split(':', 2)
lnum = int(lnum)
line = text[lnum-1].rstrip()
if fn == model and (lnum-1) in range(len(text)):
line = text[lnum-1].rstrip()
else:
line = None
items.append((lnum, line, msg))
if 'error: ' in msg:
errors += 1