@@ -189,7 +189,11 @@ def __init__(self,*args):
189
189
elif proxyType in ["5" ,"FtpCachingProxy" ] and QT_VERSION >= 0X040400 : self .proxy .setType (QNetworkProxy .FtpCachingProxy )
190
190
else : self .proxy .setType (QNetworkProxy .DefaultProxy )
191
191
self .proxy .setHostName (settings .value ("/proxyHost" ,"" , type = unicode ))
192
- self .proxy .setPort (settings .value ("/proxyPort" , 0 , type = int ))
192
+ try :
193
+ # QSettings may contain non-int value...
194
+ self .proxy .setPort (settings .value ("/proxyPort" , 0 , type = int ))
195
+ except :
196
+ pass
193
197
self .proxy .setUser (settings .value ("/proxyUser" , "" , type = unicode ))
194
198
self .proxy .setPassword (settings .value ("/proxyPassword" , "" , type = unicode ))
195
199
self .setProxy (self .proxy )
@@ -320,7 +324,12 @@ def setCheckingOnStart(self, state):
320
324
def checkingOnStartInterval (self ):
321
325
""" return checking for news and updates interval """
322
326
settings = QSettings ()
323
- i = settings .value (settingsGroup + "/checkOnStartInterval" , 1 , type = int )
327
+ try :
328
+ # QSettings may contain non-int value...
329
+ i = settings .value (settingsGroup + "/checkOnStartInterval" , 1 , type = int )
330
+ except :
331
+ # fallback do 1 day by default
332
+ i = 1
324
333
if i < 0 : i = 1
325
334
# allowed values: 0,1,3,7,14,30 days
326
335
interval = 0
@@ -350,7 +359,11 @@ def timeForChecking(self):
350
359
if self .checkingOnStartInterval () == 0 :
351
360
return True
352
361
settings = QSettings ()
353
- interval = settings .value (settingsGroup + "/checkOnStartLastDate" ,type = QDate ).daysTo (QDate .currentDate ())
362
+ try :
363
+ # QSettings may contain ivalid value...
364
+ interval = settings .value (settingsGroup + "/checkOnStartLastDate" ,type = QDate ).daysTo (QDate .currentDate ())
365
+ except :
366
+ interval = 0
354
367
if interval >= self .checkingOnStartInterval ():
355
368
return True
356
369
else :
0 commit comments