From 6432922c7625c700c9650d9d0c56f8d385576f95 Mon Sep 17 00:00:00 2001 From: Georgiy Komarov Date: Sun, 27 Jun 2021 23:57:37 +0300 Subject: [PATCH] misra: Fix crash on rule 8.2 (#3310) The example code that reproduces this crash: ``` int misra_8_2_o( const uint32_t a1, const uint8_t *const a2 ) { return *a2 + a1; } int misra_8_2_p( const uint32_t a1, const uint8_t *const a2 ); ``` The unit test was not added because it looks like a typo and regressions are unlikely. --- addons/misra.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/misra.py b/addons/misra.py index cd696c094..e6c62c2b5 100755 --- a/addons/misra.py +++ b/addons/misra.py @@ -1471,7 +1471,7 @@ class MisraChecker: for _ in range(count): rawToken = rawToken.next # Skip comments - while rawTokens and (rawToken.str.startswith('/*') or rawToken.str.startswith('//')): + while rawToken and (rawToken.str.startswith('/*') or rawToken.str.startswith('//')): rawToken = rawToken.next if rawToken is None: break