From 0e56c1805854ca7dc740c0872e9bb1d659a9f6ca Mon Sep 17 00:00:00 2001 From: Jimmy Brisson Date: Mon, 25 Jun 2018 18:04:11 -0500 Subject: [PATCH] Check for no match in version check --- tools/toolchains/arm.py | 2 +- tools/toolchains/gcc.py | 2 +- tools/toolchains/iar.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/toolchains/arm.py b/tools/toolchains/arm.py index 12e400552b..2d1d195314 100644 --- a/tools/toolchains/arm.py +++ b/tools/toolchains/arm.py @@ -105,7 +105,7 @@ class ARM(mbedToolchain): msg = ("Compiler version mismatch: Have {}; " "expected version >= {} and < {}" .format(found_version, min_ver, max_ver)) - elif len(match.groups()) != 1: + elif not match or len(match.groups()) != 1: msg = ("Compiler version mismatch: Could not detect version; " "expected version >= {} and < {}" .format(min_ver, max_ver)) diff --git a/tools/toolchains/gcc.py b/tools/toolchains/gcc.py index d61fa57bc5..43d3ba0734 100644 --- a/tools/toolchains/gcc.py +++ b/tools/toolchains/gcc.py @@ -122,7 +122,7 @@ class GCC(mbedToolchain): msg = ("Compiler version mismatch: Have {}; " "expected version >= {} and < {}" .format(found_version, min_ver, max_ver)) - elif len(match.groups()) != 1: + elif not match or len(match.groups()) != 1: msg = ("Compiler version mismatch: Could not detect version; " "expected version >= {} and < {}" .format(min_ver, max_ver)) diff --git a/tools/toolchains/iar.py b/tools/toolchains/iar.py index 02a38f21a1..92d9af8262 100644 --- a/tools/toolchains/iar.py +++ b/tools/toolchains/iar.py @@ -103,7 +103,7 @@ class IAR(mbedToolchain): if found_version and LooseVersion(found_version) != self.IAR_VERSION: msg = "Compiler version mismatch: Have {}; expected {}".format( found_version, self.IAR_VERSION) - elif len(match.groups()) != 1: + elif not match or len(match.groups()) != 1: msg = ("Compiler version mismatch: Could Not detect compiler " "version; expected {}".format(self.IAR_VERSION)) if msg: