Skip to content

Commit e027965

Browse files
committed
fix null pointer access in unused.d
1 parent 1597733 commit e027965

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/dscanner/analysis/unused.d

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,8 @@ abstract class UnusedStorageCheck : UnusedIdentifierCheck
434434
// enum name = "abc";
435435
// __traits(hasMember, S, name);
436436
ignoreDeclarations++;
437-
traitsExp.templateArgumentList.accept(this);
437+
if (traitsExp.templateArgumentList)
438+
traitsExp.templateArgumentList.accept(this);
438439
ignoreDeclarations--;
439440
}
440441

src/dscanner/analysis/unused_variable.d

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,12 @@ final class UnusedVariableCheck : UnusedStorageCheck
117117
__traits(compiles, { int i = 2; });
118118
}
119119

120+
// segfault with null templateArgumentList
121+
void nullTest()
122+
{
123+
__traits(isPOD);
124+
}
125+
120126
}c, sac);
121127
stderr.writeln("Unittest for UnusedVariableCheck passed.");
122128
}

0 commit comments

Comments
 (0)