misra: Fix crash in misra_9.py when struct type is unknown and there is string initialization (#5233)

This commit is contained in:
Daniel Marjamäki 2023-07-11 13:40:19 +02:00 committed by GitHub
parent a04990d4e3
commit 80c42fcaf3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -255,7 +255,7 @@ class InitializerParser:
isFirstElement = False
isDesignated = True
elif self.token.isString and self.ed.isArray:
elif self.token.isString and self.ed and self.ed.isArray:
self.ed.setInitialized(isDesignated)
if self.token == self.token.astParent.astOperand1 and self.token.astParent.astOperand2:
self.token = self.token.astParent.astOperand2

View File

@ -0,0 +1,8 @@
static const struct id3_frametype wordlist[] =
{
{0, "Encryption method registration"},
{1, "Popularimeter"},
};