Skip to content

Commit

Permalink
init analyzer = None and rebind to guard NameError
Browse files Browse the repository at this point in the history
It might make more sense to hoist the call to Analyzer() before the
try/except, but any chance to catch failure conditions is better while
this code is still in rough shape.
  • Loading branch information
nbargnesi committed Apr 11, 2024
1 parent 5763f5b commit 39107bc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions analyzer/windows/analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1443,6 +1443,7 @@ def dispatch(self, data):
error = ""
completion_key = ""
data = {}
analyzer = None
try:
# Initialize the main analyzer class.
analyzer = Analyzer()
Expand Down Expand Up @@ -1491,8 +1492,8 @@ def dispatch(self, data):
finally:
try:
# Let's invoke the completion procedure.
# BUG(njb) potentially; analyzer is bound in above try and could fail
analyzer.complete()
if analyzer is not None:
analyzer.complete()
except Exception:
complete_excp = traceback.format_exc()
data["status"] = "exception"
Expand Down

0 comments on commit 39107bc

Please sign in to comment.