Merge "Catch unicode decode errors search for kernel ver"
diff --git a/tools/extract_kernel.py b/tools/extract_kernel.py
index 16ccb22..42561cf 100755
--- a/tools/extract_kernel.py
+++ b/tools/extract_kernel.py
@@ -47,7 +47,10 @@
null_idx = input_bytes.find('\x00', start_idx)
if null_idx < 0:
return None
- linux_banner = input_bytes[start_idx:null_idx].decode()
+ try:
+ linux_banner = input_bytes[start_idx:null_idx].decode()
+ except UnicodeDecodeError:
+ return None
mo = re.match(LINUX_BANNER_REGEX, linux_banner)
if mo:
return mo.group(1)