]> granicus.if.org Git - esp-idf/commitdiff
tiny-test-fw: fix exception when expect RegEx:
authorHe Yin Ling <heyinling@espressif.com>
Thu, 29 Nov 2018 06:33:36 +0000 (14:33 +0800)
committerbot <bot@espressif.com>
Fri, 7 Dec 2018 02:04:55 +0000 (02:04 +0000)
match.groups() could return None. We can't do decode on None object.

tools/tiny-test-fw/DUT.py

index 88894fd4967bb588daf89bc2ad82904aa5f35e72..899c7e885085e0854cb1ef468fbfe4e39183764c 100644 (file)
@@ -530,7 +530,7 @@ class BaseDUT(object):
             data = BaseDUT.u_to_bytearray(data)
         match = pattern.search(data)
         if match:
-            ret = tuple(x.decode() for x in match.groups())
+            ret = tuple(None if x is None else x.decode() for x in match.groups())
             index = match.end()
         else:
             index = -1