Softwaremanager: fix potential crash when trying to delete from empty list.
[enigma2.git] / lib / python / Plugins / SystemPlugins / SoftwareManager / BackupRestore.py
index 871f0a307c4c951485a61b7ccaaaf46bf91437fd..7bd7d7a224bf7b3d4dbf643aa1c57856100f68fb 100755 (executable)
@@ -66,6 +66,7 @@ class BackupScreen(Screen, ConfigListScreen):
                self.setTitle(_("Backup is running..."))
 
        def doBackup(self):
+               configfile.save()
                try:
                        if (path.exists(self.backuppath) == False):
                                makedirs(self.backuppath)
@@ -250,8 +251,9 @@ class RestoreMenu(Screen):
        def KeyOk(self):
                if (self.exe == False) and (self.entry == True):
                        self.sel = self["filelist"].getCurrent()
-                       self.val = self.path + "/" + self.sel
-                       self.session.openWithCallback(self.startRestore, MessageBox, _("Are you sure you want to restore\nfollowing backup:\n" + self.sel + "\nSystem will restart after the restore!"))
+                       if self.sel:
+                               self.val = self.path + "/" + self.sel
+                               self.session.openWithCallback(self.startRestore, MessageBox, _("Are you sure you want to restore\nfollowing backup:\n") + self.sel + _("\nSystem will restart after the restore!"))
 
        def keyCancel(self):
                self.close()
@@ -264,8 +266,9 @@ class RestoreMenu(Screen):
        def deleteFile(self):
                if (self.exe == False) and (self.entry == True):
                        self.sel = self["filelist"].getCurrent()
-                       self.val = self.path + "/" + self.sel
-                       self.session.openWithCallback(self.startDelete, MessageBox, _("Are you sure you want to delete\nfollowing backup:\n" + self.sel ))
+                       if self.sel:
+                               self.val = self.path + "/" + self.sel
+                               self.session.openWithCallback(self.startDelete, MessageBox, _("Are you sure you want to delete\nfollowing backup:\n" + self.sel ))
 
        def startDelete(self, ret = False):
                if (ret == True):