[PATCH] Protect against tracebacks from the partition isFoo properties.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This just prevents us from trying to use self.partType if it is None.
---
 storage/devices.py |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/storage/devices.py b/storage/devices.py
index 53c3d83..c6fbdcc 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -997,19 +997,23 @@ class PartitionDevice(StorageDevice):
 
     @property
     def isExtended(self):
-        return self.partType & parted.PARTITION_EXTENDED
+        return (self.partType is not None and
+                self.partType & parted.PARTITION_EXTENDED)
 
     @property
     def isLogical(self):
-        return self.partType & parted.PARTITION_LOGICAL
+        return (self.partType is not None and
+                self.partType & parted.PARTITION_LOGICAL)
 
     @property
     def isPrimary(self):
-        return self.partType == parted.PARTITION_NORMAL
+        return (self.partType is not None and
+                self.partType == parted.PARTITION_NORMAL)
 
     @property
     def isProtected(self):
-        return self.partType & parted.PARTITION_PROTECTED
+        return (self.partType is not None and
+                self.partType & parted.PARTITION_PROTECTED)
 
     def _getPartedPartition(self):
         return self._partedPartition
-- 
1.6.0.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux