chiark / gitweb /
Fix a few NoneType errors.
authorSimon Tatham <anakin@pobox.com>
Fri, 15 Dec 2023 17:30:26 +0000 (17:30 +0000)
committerSimon Tatham <anakin@pobox.com>
Fri, 15 Dec 2023 17:30:26 +0000 (17:30 +0000)
client.py

index 8fbc42fa41822fe7c7dec5cefc6eced5b957a58f..365a34a64a247814b262fb212fdd28d439121170 100644 (file)
--- a/client.py
+++ b/client.py
@@ -232,7 +232,7 @@ class IncrementalServerFeed(Feed):
             return False
         self.data[0:0] = list(self.get(d) for d in reversed(data))
         self.origin += len(data)
-        self.next_link = links['next']
+        self.next_link = links.get('next')
         return len(data) > 0
 
     def extend_future(self):
@@ -244,7 +244,7 @@ class IncrementalServerFeed(Feed):
         if len(data) == 0:
             return False
         self.data.extend(self.get(d) for d in reversed(data))
-        self.prev_link = links['prev']
+        self.prev_link = links.get('prev')
         return len(data) > 0
 
 class HomeTimelineFeed(IncrementalServerFeed):
@@ -446,7 +446,9 @@ class Status:
                         self.client.fq(mention['acct']), 'f'))
                 yield text.BlankLine()
 
-            app_subdict = self.data.get('application', {})
+            app_subdict = self.data.get('application')
+            if app_subdict is None:
+                app_subdict = {}
             client = noneify(app_subdict.get('name'))
             yield text.Paragraph("Client name: " + client)
             client_url = noneify(app_subdict.get('website'), colour='u')