File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -192,15 +192,16 @@ async def _run(self, loop):
192
192
# Update takes a line of text
193
193
async def _update (self , line ):
194
194
line = line .rstrip () # Copy line
195
+ # Basic integrity check: may have received partial line e.g on power up
196
+ if not line .startswith ('$' ) or not '*' in line or len (line ) > self ._SENTENCE_LIMIT :
197
+ return
195
198
if self .FULL_CHECK : # 9ms on Pyboard
196
199
try :
197
200
next (c for c in line if ord (c ) < 10 or ord (c ) > 126 )
198
201
return # Bad character received
199
202
except StopIteration :
200
203
pass # All good
201
204
await asyncio .sleep (0 )
202
- if len (line ) > self ._SENTENCE_LIMIT or not '*' in line :
203
- return # Too long or malformed
204
205
205
206
a = line .split (',' )
206
207
segs = a [:- 1 ] + a [- 1 ].split ('*' )
You can’t perform that action at this time.
0 commit comments