Skip to content

Commit

Permalink
Check input_file attribut
Browse files Browse the repository at this point in the history
  • Loading branch information
markqvist committed Jan 14, 2024
1 parent 8e1e2a9 commit a37e039
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions RNS/Resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -625,11 +625,13 @@ def validate_proof(self, proof_data):
except Exception as e:
RNS.log("Error while executing resource concluded callback from "+str(self)+". The contained exception was: "+str(e), RNS.LOG_ERROR)
finally:
if hasattr(self.input_file, "close") and callable(self.input_file.close):
try:
self.input_file.close()
except Exception as e:
RNS.log("Error while closing resource input file: "+str(e), RNS.LOG_ERROR)
try:
if hasattr(self, "input_file"):
if hasattr(self.input_file, "close") and callable(self.input_file.close):
self.input_file.close()

except Exception as e:
RNS.log("Error while closing resource input file: "+str(e), RNS.LOG_ERROR)
else:
# Otherwise we'll recursively create the
# next segment of the resource
Expand Down

0 comments on commit a37e039

Please sign in to comment.