Skip to content

Commit

Permalink
patch: fix NoneType error for 'visit_Case' function in c_generator.py…
Browse files Browse the repository at this point in the history
… when a case is empty by adding none type checker
  • Loading branch information
kmg3821 committed Jul 22, 2024
1 parent ab00af8 commit be59b21
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pycparser/c_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,9 @@ def visit_Switch(self, n):

def visit_Case(self, n):
s = 'case ' + self.visit(n.expr) + ':\n'
for stmt in n.stmts:
s += self._generate_stmt(stmt, add_indent=True)
if n.stmts is not None :
for stmt in n.stmts:
s += self._generate_stmt(stmt, add_indent=True)
return s

def visit_Default(self, n):
Expand Down

0 comments on commit be59b21

Please sign in to comment.