Skip to content

Commit

Permalink
add validation: modemlist is JSON structure
Browse files Browse the repository at this point in the history
  • Loading branch information
neuholdm committed Oct 19, 2015
1 parent dad8c1f commit bf70635
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pid/pid.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,11 @@ def run(self):

modemcfg = cfg.getvalue('modemlist', '[{}]', 'pid')

# convert json to list of dictionary entries
modemlist = json.loads(modemcfg)
try:
# convert json to list of dictionary entries
modemlist = json.loads(modemcfg)
except:
cfg.errorandexit("modemlist - not a valid JSON structure!")

# check if modemcfg is set
if 'modemid' not in modemlist[0]:
Expand Down

0 comments on commit bf70635

Please sign in to comment.