osbuild-mpp: fix PartitionTable.__getitem__() bail-out

The __getitem__() function incorrectly returns `None` if the
partition-type is not found. Make sure to always return IndexError if
the requested value is outside the supported range.

Signed-off-by: David Rheinsberg <david.rheinsberg@gmail.com>
This commit is contained in:
David Rheinsberg 2022-09-13 12:39:31 +02:00 committed by Simon de Vlieger
parent 8c367dfa6f
commit 8c6049f197

View file

@ -827,8 +827,7 @@ class PartitionTable:
for part in self.partitions:
if part.id == key:
return part
else:
raise ValueError("unsupported type")
raise IndexError
def write_to(self, target, sync=True):
"""Write the partition table to disk"""