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

Bug #1604341 reported by Cas on 2016-07-19
This bug affects 1 person
Affects Status Importance Assigned to Milestone

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/", line 509, in update_reputation
    self.display_notification(account["site_name"] + ":", message, account['site'])
  File "/usr/share/stackapplet/", 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  Edit
Everyone can see this information.

Other bug subscribers