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:
parent
8c367dfa6f
commit
8c6049f197
1 changed files with 1 additions and 2 deletions
|
|
@ -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"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue