Fixed defects found by Coverity

This commit is contained in:
alby128 2017-10-31 15:22:58 +01:00
parent 0557249c43
commit 5a82a6db61
3 changed files with 12 additions and 6 deletions

View File

@ -330,13 +330,19 @@ class SyncServerProtocol(JSONCommandProtocol):
def _extractHelloArguments(self, hello):
roomName = None
username = hello["username"] if hello.has_key("username") else None
username = username.strip()
if hello.has_key("username"):
username = hello["username"]
username = username.strip()
else:
username = None
serverPassword = hello["password"] if hello.has_key("password") else None
room = hello["room"] if hello.has_key("room") else None
if room:
roomName = room["name"] if room.has_key("name") else None
roomName = roomName.strip()
if room.has_key("name"):
roomName = room["name"]
roomName = roomName.strip()
else:
roomName = None
version = hello["version"] if hello.has_key("version") else None
version = hello["realversion"] if hello.has_key("realversion") else version
return username, serverPassword, roomName, version

View File

@ -518,7 +518,7 @@ class MainWindow(QtWidgets.QMainWindow):
filenameitem.setForeground(QtGui.QBrush(QtGui.QColor(constants.STYLE_DIFFERENTITEM_COLOR)))
filenameitem.setFont(underlinefont)
if not sameSize:
if currentUser.file is not None and formatSize(user.file['size']) == formatSize(currentUser.file['size']):
if formatSize(user.file['size']) == formatSize(currentUser.file['size']):
filesizeitem = QtGui.QStandardItem(formatSize(user.file['size'],precise=True))
filesizeitem.setFont(underlinefont)
filesizeitem.setForeground(QtGui.QBrush(QtGui.QColor(constants.STYLE_DIFFERENTITEM_COLOR)))

View File

@ -42,8 +42,8 @@ def retry(ExceptionToCheck, tries=4, delay=3, backoff=2, logger=None):
try_one_last_time = True
while mtries > 1:
try:
#try_one_last_time = False
return f(*args, **kwargs)
try_one_last_time = False
break
except ExceptionToCheck, e:
if logger: