Skip to content

Commit

Permalink
if source was deleted do not access source
Browse files Browse the repository at this point in the history
  • Loading branch information
Allie Crevier committed Mar 10, 2020
1 parent cb4d8dc commit 3ed5c88
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions securedrop_client/gui/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -845,15 +845,15 @@ def update(self, sources: List[Source]):
list_item = self.item(i)
list_widget = self.itemWidget(list_item)

if list_widget and list_widget.source.uuid not in source_uuids:
if list_widget and list_widget.uuid not in source_uuids:
if list_item.isSelected():
self.setCurrentItem(None)
del self.source_widgets[list_widget.source.uuid]
del self.source_widgets[list_widget.source_uuid]
self.takeItem(i)
list_widget.deleteLater()

# Create new widgets for new sources
widget_uuids = [self.itemWidget(self.item(i)).source.uuid for i in range(self.count())]
widget_uuids = [self.itemWidget(self.item(i)).source_uuid for i in range(self.count())]
for source in sources:
if source.uuid not in widget_uuids:
new_source = SourceWidget(source)
Expand Down Expand Up @@ -949,6 +949,7 @@ def __init__(self, source: Source):

# Store source
self.source = source
self.source_uuid = source.uuid

# Set styles
self.setStyleSheet(self.CSS)
Expand Down

0 comments on commit 3ed5c88

Please sign in to comment.