self.stackauth is None when updating sites in display_notification()

Bug #1604341 reported by Cas
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
StackApplet
New
Undecided
Unassigned

Bug Description

Not sure why/when this bug surfaced only recently but I noticed one of the sites was stuck 'Loading...' and investigating further revealed this stacktrace:

Traceback (most recent call last):
  File "/usr/share/stackapplet/stackapplet.py", line 509, in update_reputation
    self.display_notification(account["site_name"] + ":", message, account['site'])
  File "/usr/share/stackapplet/stackapplet.py", line 377, in display_notification
    for site in self.stackauth['api_sites']:
TypeError: 'NoneType' object has no attribute '__getitem__'

Looking at the code it seems there is a possible race condition in initialising resulting in self.stackauth still being 'None' in display_notification method. Adding a test before the for loop fixed the issue here:

+if not self.stackauth:
+ return
# We need to determine which site is equivalent to this image.
for site in self.stackauth['api_sites']:

For reference I am running stackapplet on Ubuntu 16.04.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.