Fixed #11000 (misra: crash)

This commit is contained in:
Daniel Marjamäki 2022-05-03 22:03:24 +02:00
parent 1e40a2e73e
commit b444c002e2
2 changed files with 3 additions and 1 deletions

View File

@ -1837,7 +1837,7 @@ class MisraChecker:
usedParameter = parametersUsed[i]
parameterDefinition = functionDeclaration.argument.get(i+1)
if usedParameter.isString and parameterDefinition.nameToken:
if usedParameter.isString and parameterDefinition and parameterDefinition.nameToken:
reportErrorIfVariableIsNotConst(parameterDefinition.nameToken, usedParameter)
def misra_8_1(self, cfg):

View File

@ -315,6 +315,7 @@ static const char *misra_7_4_return_const (void) { return 1 + "return_const"; }
static void misra_7_4_const_call(int a, const char* b) { } // 2.7
static void misra_7_4_const_ptr_call(int a, const char const* b) { } // 2.7
static void misra_7_4_call(int a, char* b) { } // 2.7
static void misra_7_4_call_2(int a, ...) { } // 2.7
static void misra_7_4(void)
{
@ -330,6 +331,7 @@ static void misra_7_4(void)
misra_7_4_const_call(1, ("text_const_call"));
misra_7_4_const_ptr_call(1, ("text_const_call"));
misra_7_4_call(1, "text_call"); // 7.4 11.8
misra_7_4_call_2(1, "a", "b");
}
const misra_8_1_a; // 8.1 8.4