From 0cf4ab99f492f24f68131d1a754c25370557426f Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 15 Mar 2021 15:23:19 +0000 Subject: [PATCH 1/2] Handle none returned --- notifications_client.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/notifications_client.py b/notifications_client.py index 8824c804b..7acfb30c8 100644 --- a/notifications_client.py +++ b/notifications_client.py @@ -1157,6 +1157,8 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str, currIndex = currSentIndex speakerJson = \ _getSpeakerJsonFromIndex(currTimeline, currIndex) + if not speakerJson: + speakerJson = {} if speakerJson.get('detectedLinks'): if ' ' in keyPress: index = keyPress.split(' ')[1] From 93d151039bf45e6386a47b751afa5a43482cf194 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 15 Mar 2021 15:25:43 +0000 Subject: [PATCH 2/2] Debug --- notifications_client.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/notifications_client.py b/notifications_client.py index 7acfb30c8..14bdfe08c 100644 --- a/notifications_client.py +++ b/notifications_client.py @@ -1159,12 +1159,15 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str, _getSpeakerJsonFromIndex(currTimeline, currIndex) if not speakerJson: speakerJson = {} + print('speakerJson: ' + str(speakerJson)) if speakerJson.get('detectedLinks'): if ' ' in keyPress: - index = keyPress.split(' ')[1] - if index.isdigit(): + postIndex = keyPress.split(' ')[1].strip() + print('postIndex: ' + str(postIndex)) + if postIndex.isdigit(): speakerJson = \ - _getSpeakerJsonFromIndex(currTimeline, index) + _getSpeakerJsonFromIndex(currTimeline, + int(postIndex)) sayStr = 'Opening web links in browser.' _sayCommand(sayStr, sayStr, originalScreenReader, systemLanguage, espeak)