summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/releasetools/sparse_img.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/releasetools/sparse_img.py b/tools/releasetools/sparse_img.py
index c9e7e76..d2955c3 100644
--- a/tools/releasetools/sparse_img.py
+++ b/tools/releasetools/sparse_img.py
@@ -201,8 +201,12 @@ class SparseImage(object):
nonzero_blocks.append(b)
nonzero_blocks.append(b+1)
- out["__ZERO"] = RangeSet(data=zero_blocks)
- out["__NONZERO"] = RangeSet(data=nonzero_blocks)
+ assert zero_blocks or nonzero_blocks
+
+ if zero_blocks:
+ out["__ZERO"] = RangeSet(data=zero_blocks)
+ if nonzero_blocks:
+ out["__NONZERO"] = RangeSet(data=nonzero_blocks)
def ResetFileMap(self):
"""Throw away the file map and treat the entire image as