From dbe23f878bd0b4089ef78d88088ca047d4fdc698 Mon Sep 17 00:00:00 2001 From: Georgy Komarov Date: Wed, 13 Nov 2019 09:58:26 +0300 Subject: [PATCH] misra.py: Fix R21.1 crash on C++ code (#2354) Variables from cppcheckdata.Variable have no nameToken if they are objects of user-defined classes. --- addons/misra.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/misra.py b/addons/misra.py index 99b1e4265..a542dcaac 100755 --- a/addons/misra.py +++ b/addons/misra.py @@ -1916,6 +1916,8 @@ class MisraChecker: token = i.nameToken elif isinstance(i, cppcheckdata.Function): token = i.tokenDef + if not token: + continue if len(token.str) < 2: continue if token.str == 'errno':