Skip to content

Commit 06e44ae

Browse files
committed
Fixed segmentation fault caused by accessing nonexistent child
1 parent 4585345 commit 06e44ae

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/tstool/dfbscan_extractor/Javascript/Javascript_NPD_extractor.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ def is_global_source(self, global_declaration_node: Tree) -> bool:
6161
sibling = global_declaration_node.next_sibling
6262

6363
while sibling is not None:
64+
if len(sibling.children) == 0:
65+
sibling = sibling.next_sibling
66+
continue
67+
6468
expr = sibling.child(0)
6569

6670
if self.is_expression_delete(expr):
@@ -72,7 +76,7 @@ def is_global_source(self, global_declaration_node: Tree) -> bool:
7276
if self.is_expression_nullable(expr) and expr.child(0).text == global_name:
7377
return True
7478

75-
return False
79+
sibling = sibling.next_sibling
7680
return False
7781

7882
def is_global_sink(self, global_declarator_node: Tree) -> bool:

0 commit comments

Comments
 (0)