Skip to content

Commit

Permalink
fix crash when no config file
Browse files Browse the repository at this point in the history
This fixes an exception when there is not config file. The changes from commit cad30b1 introduced this error.
  • Loading branch information
dlech committed Apr 28, 2018
1 parent a7667d5 commit a111be0
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions nxt/locator.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,12 @@ def find_one_brick(host=None, name=None, silent=False, strict=None, debug=False,
host = conf.get('Brick', 'host')
name = conf.get('Brick', 'name')
strict = bool(int(conf.get('Brick', 'strict')))
methods = map(lambda x: x.strip().split('='),
conf.get('Brick', 'method').split(','))
method = Method(**{k: v == 'True' for k, v in methods
if k in ('bluetooth', 'usb', 'device')})
method_value = conf.get('Brick', 'method')
if method_value:
methods = map(lambda x: x.strip().split('='),
method_value.split(','))
method = Method(**{k: v == 'True' for k, v in methods
if k in ('bluetooth', 'usb', 'device')})
if not strict: strict = True
if not method: method = Method()

Expand Down

0 comments on commit a111be0

Please sign in to comment.