From 24759d2762e526b69df57eb3554ced3aa42f8370 Mon Sep 17 00:00:00 2001 From: Wojciech Zygmunt Porczyk Date: Thu, 4 Sep 2014 21:59:05 +0200 Subject: [PATCH] settings.py: do not attempt to remove service when none selected Thanks to Andrew B (kyboren at gmail dot com) for bug report. --- qubesmanager/settings.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/qubesmanager/settings.py b/qubesmanager/settings.py index b2f653a..83c485d 100755 --- a/qubesmanager/settings.py +++ b/qubesmanager/settings.py @@ -762,12 +762,16 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog): def __remove_service__(self): item = self.services_list.currentItem() + + if not item: + return if str(item.text()) == 'meminfo-writer': QMessageBox.information(None, "Service can not be removed", "Service meminfo-writer can not be removed from the list.") - else: - row = self.services_list.currentRow() - item = self.services_list.takeItem(row) - del self.new_srv_dict[str(item.text())] + return + + row = self.services_list.currentRow() + item = self.services_list.takeItem(row) + del self.new_srv_dict[str(item.text())] def services_item_clicked(self, item):