[master 1/1] Fix IndexError: list index out of range (#1219004)
jkonecny12
installerbot-noreply at redhat.com
Thu May 14 07:55:39 UTC 2015
From: Jiri Konecny <jkonecny at redhat.com>
Add user input boundary test to text ui Timezone settings.
---
pyanaconda/ui/tui/spokes/time_spoke.py | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/pyanaconda/ui/tui/spokes/time_spoke.py b/pyanaconda/ui/tui/spokes/time_spoke.py
index 653df0f..64548e9 100644
--- a/pyanaconda/ui/tui/spokes/time_spoke.py
+++ b/pyanaconda/ui/tui/spokes/time_spoke.py
@@ -115,18 +115,25 @@ def input(self, args, key):
else:
return key
+ if keyid < 0:
+ return key
if args:
+ if keyid >= len(self._timezones[args]):
+ return key
self._selection = "%s/%s" % (args, self._timezones[args][keyid])
self.apply()
self.close()
else:
- if len(self._timezones[self._regions[keyid]]) == 1:
- self._selection = "%s/%s" % (self._regions[keyid],
- self._timezones[self._regions[keyid]][0])
+ if keyid >= len(self._regions):
+ return key
+ region = self._regions[keyid]
+ selected_timezones = self._timezones[region]
+ if len(selected_timezones) == 1:
+ self._selection = "%s/%s" % (region, selected_timezones[0])
self.apply()
self.close()
else:
- self.app.switch_screen(self, self._regions[keyid])
+ self.app.switch_screen(self, region)
return INPUT_PROCESSED
def prompt(self, args=None):
--
To view this commit on github, visit https://github.com/rhinstaller/anaconda/commit/491cf75aaa300ab2e66de517ece0764e0143f61e
More information about the anaconda-patches
mailing list