BmapCopy.py: fix incorrect assignment
authorArtem Bityutskiy <artem.bityutskiy@intel.com>
Tue, 20 Nov 2012 09:11:24 +0000 (11:11 +0200)
committerArtem Bityutskiy <artem.bityutskiy@intel.com>
Tue, 20 Nov 2012 14:55:20 +0000 (16:55 +0200)
This patch fixes the following bug:

UnboundLocalError: local variable 'last' referenced before assignment

which happens when the range consists only of one block.

Change-Id: I4d91d2abdd45408b6d2a6131e3ddd7fbbe3492f9
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
bmaptools/BmapCopy.py

index 3b16a84..59aa2d2 100644 (file)
@@ -301,7 +301,7 @@ class BmapCopy:
                 if first > last:
                     raise Error("bad range (first > last): '%s'" % blocks_range)
             else:
-                first = last
+                last = first
 
             if 'sha1' in xml_element.attrib:
                 sha1 = xml_element.attrib['sha1']