resolved conflicts for merge of 8787cd6d to mnc-dev

Change-Id: I19497d05a021c21c905b2bddd5b36d370dc2208f
diff --git a/tools/releasetools/sparse_img.py b/tools/releasetools/sparse_img.py
index 49b3a67..7019f00 100644
--- a/tools/releasetools/sparse_img.py
+++ b/tools/releasetools/sparse_img.py
@@ -221,9 +221,14 @@
           nonzero_blocks.append(b)
           nonzero_blocks.append(b+1)
 
-    out["__ZERO"] = rangelib.RangeSet(data=zero_blocks)
-    out["__NONZERO"] = rangelib.RangeSet(data=nonzero_blocks)
-    out["__COPY"] = clobbered_blocks
+    assert zero_blocks or nonzero_blocks or clobbered_blocks
+
+    if zero_blocks:
+      out["__ZERO"] = rangelib.RangeSet(data=zero_blocks)
+    if nonzero_blocks:
+      out["__NONZERO"] = rangelib.RangeSet(data=nonzero_blocks)
+    if clobbered_blocks:
+      out["__COPY"] = clobbered_blocks
 
   def ResetFileMap(self):
     """Throw away the file map and treat the entire image as