Check return of _load_state

In error scenarios there might be no loadable state available.
This patch adds some robustness handling this scenarios
by checking the result and possible bailing out.

Change-Id: I02e2731b14bec22c22db08d60d8d15db1911a84e
Signed-off-by: Andreas Florath <andreas@florath.net>
This commit is contained in:
Andreas Florath 2017-02-04 19:21:48 +00:00
parent 3f8800832a
commit df1f583903

View File

@ -179,6 +179,8 @@ local_loop:
"""Cleanup all remaining relicts - in good case""" """Cleanup all remaining relicts - in good case"""
dg, reverse_order, state = self._load_state() dg, reverse_order, state = self._load_state()
if dg is None:
return 0
for node in reverse_order: for node in reverse_order:
node.cleanup(state) node.cleanup(state)
@ -191,6 +193,8 @@ local_loop:
"""Cleanup all remaining relicts - in case of an error""" """Cleanup all remaining relicts - in case of an error"""
dg, reverse_order, state = self._load_state() dg, reverse_order, state = self._load_state()
if dg is None:
return 0
for node in reverse_order: for node in reverse_order:
node.delete(state) node.delete(state)