ephraim / lcurse

Python script to have a "curse" compatible client for linux
The Unlicense
51 stars 24 forks source link

Fix crash when updating all plugins (result acccessed before it was defined) #16

Closed laino closed 8 years ago

laino commented 8 years ago
diff --git a/modules/waitdlg.py b/modules/waitdlg.py
index 69bb362..710aa39 100644
--- a/modules/waitdlg.py
+++ b/modules/waitdlg.py
@@ -141,11 +141,17 @@ class CheckWorker(Qt.QThread):
                return (False, None)

        def run(self):
+               result = None
+
                if self.addon[2].startswith("http://www.curse.com"):
                        result = self.needsUpdateCurse()
                elif self.addon[2].endswith(".git"):
                        result = self.needsUpdateGit()
-               self.checkFinished.emit(self.addon, result[0], result[1])
+
+               if result != None:
+                       self.checkFinished.emit(self.addon, result[0], result[1])
+               else:
+                       self.checkFinished.emit(self.addon, False, False)

 class UpdateDlg(Qt.QDialog):
        updateFinished = Qt.pyqtSignal(Qt.QVariant, bool)
ephraim commented 8 years ago

accepted and pushed.