gravatar: guard against self.response being None

While this condition has never been spotted in the wild, let's
make sure that we have data before reading it.

Signed-off-by: David Aguilar <davvid@gmail.com>
This commit is contained in:
David Aguilar
2019-03-05 23:47:42 -08:00
parent b102d42e9a
commit 7fdef9617d
+2
View File
@@ -111,6 +111,8 @@ class GravatarLabel(QtWidgets.QLabel):
self.pixmaps[email] = pixmap
def set_pixmap_from_response(self):
if self.response is None:
self.response = self._default_pixmap_bytes()
pixmap = QtGui.QPixmap()
pixmap.loadFromData(self.response)
self.setPixmap(pixmap)