[PATCH] Check whether a payload has an instclass (#1185588)

David Shea dshea at redhat.com
Mon Jan 26 14:54:14 UTC 2015


The instclass is set when the payload is setup, so don't crash on
unsetup payloads.
---
 pyanaconda/ui/gui/spokes/software.py | 2 +-
 pyanaconda/ui/tui/spokes/software.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/pyanaconda/ui/gui/spokes/software.py b/pyanaconda/ui/gui/spokes/software.py
index 2721ef9..5006e4c 100644
--- a/pyanaconda/ui/gui/spokes/software.py
+++ b/pyanaconda/ui/gui/spokes/software.py
@@ -280,7 +280,7 @@ class SoftwareSelectionSpoke(NormalSpoke):
         # If no environment is selected, use the default from the instclass.
         # If nothing is set in the instclass, the first environment will be
         # selected below.
-        if not self.environment:
+        if not self.environment and self.payload.instclass:
             self.environment = self.payload.instclass.defaultPackageEnvironment
 
         firstEnvironment = True
diff --git a/pyanaconda/ui/tui/spokes/software.py b/pyanaconda/ui/tui/spokes/software.py
index 0c375c9..7657648 100644
--- a/pyanaconda/ui/tui/spokes/software.py
+++ b/pyanaconda/ui/tui/spokes/software.py
@@ -75,7 +75,7 @@ class SoftwareSpoke(NormalTUISpoke):
                 environments = self.payload.environments
                 instclass = self.payload.instclass
 
-                if instclass.defaultPackageEnvironment and \
+                if instclass and instclass.defaultPackageEnvironment and \
                         instclass.defaultPackageEnvironment in environments:
                     self._selection = environments.index(instclass.defaultPackageEnvironment)
                 else:
-- 
2.1.0



More information about the anaconda-patches mailing list