From 8e12bb1bc61edf0ecf41def271ae782469aeda1c Mon Sep 17 00:00:00 2001 From: Marcel Paffrath Date: Fri, 30 Jun 2017 14:43:06 +0200 Subject: [PATCH] [bugfix] when no settings are given for phases use empty list --- pylot/core/util/widgets.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/pylot/core/util/widgets.py b/pylot/core/util/widgets.py index 8a827335..66b7d92d 100644 --- a/pylot/core/util/widgets.py +++ b/pylot/core/util/widgets.py @@ -926,8 +926,20 @@ class PickDlg(QDialog): def addPickPhases(self, menuBar): settings = QtCore.QSettings() - phases = {'P': settings.value('p_phases').split(','), - 'S': settings.value('s_phases').split(',')} + p_phases = settings.value('p_phases') + s_phases = settings.value('s_phases') + + if p_phases: + p_phases = p_phases.split(',') + else: + p_phases = [] + if s_phases: + s_phases = s_phases.split(',') + else: + s_phases = [] + + phases = {'P': p_phases, + 'S': s_phases} if not 'P' in phases['P'] and not 'p' in phases['P']: phases['P'] = ['P'] + phases['P'] if not 'S' in phases['S'] and not 's' in phases['S']: