Skip to content

Commit

Permalink
[fix] Suppress teardown warning in case the mount source was not even…
Browse files Browse the repository at this point in the history
… created yet
  • Loading branch information
mxmlnkn committed Sep 21, 2024
1 parent e82f9e7 commit c712dcf
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ratarmount.py
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,9 @@ def __del__(self) -> None:
print("[Warning] Failed to close mount point folder descriptor because of:", exception)

try:
self.mountSource.__exit__(None, None, None)
# If there is some exception in the constructor, then some members may not exist!
if hasattr(self, 'mountSource'):
self.mountSource.__exit__(None, None, None)
except Exception as exception:
if self.printDebug >= 1:
print("[Warning] Failed to tear down root mount source because of:", exception)
Expand Down

0 comments on commit c712dcf

Please sign in to comment.