From 8c6049f1979e26b6a09cce37bda9d8543ad8f85f Mon Sep 17 00:00:00 2001 From: David Rheinsberg Date: Tue, 13 Sep 2022 12:39:31 +0200 Subject: [PATCH] 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 --- tools/osbuild-mpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/osbuild-mpp b/tools/osbuild-mpp index fff74d46..a88d49d1 100755 --- a/tools/osbuild-mpp +++ b/tools/osbuild-mpp @@ -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"""