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.
This commit is contained in:
Georgiy Komarov 2021-06-27 23:57:37 +03:00 committed by GitHub
parent b89f5fbeff
commit 6432922c76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -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