diff options
author | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2012-07-26 10:46:03 +0100 |
---|---|---|
committer | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2012-07-26 12:01:58 +0100 |
commit | d957103389fca85579b96b3918b68ce65ad02cb2 (patch) | |
tree | f4edf481961772283af5675bccb26121673901c1 /morphlib | |
parent | 761c213df33c91eccb17d0f348a3f59344939f5b (diff) | |
download | morph-d957103389fca85579b96b3918b68ce65ad02cb2.tar.gz |
Fix code path for error handling
The old stuff was trying to use an uninitialized local variable.
Diffstat (limited to 'morphlib')
-rwxr-xr-x | morphlib/app.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/morphlib/app.py b/morphlib/app.py index 3fa84ac9..491adb16 100755 --- a/morphlib/app.py +++ b/morphlib/app.py @@ -734,10 +734,11 @@ class Morph(cliapp.Application): return mount_point def cleanup(path, mount_point): - try: - morphlib.fsutils.unmount(self.runcmd, mount_point) - except: - pass + if mount_point is not None: + try: + morphlib.fsutils.unmount(self.runcmd, mount_point) + except: + pass try: morphlib.fsutils.undo_device_mapping(self.runcmd, path) except: @@ -747,6 +748,8 @@ class Morph(cliapp.Application): except: pass + mount_point_1 = None + mount_point_2 = None try: mount_point_1 = setup(image_path_1) mount_point_2 = setup(image_path_2) |