Merge pull request #657 from BBasile/issue-656
fix #656 - Crash due to unsafe access in infinite range check merged-on-behalf-of: BBasile <BBasile@users.noreply.github.com>
This commit is contained in:
commit
32dd411ab5
|
@ -62,7 +62,7 @@ final class IncorrectInfiniteRangeCheck : BaseAnalyzer
|
|||
|
||||
override void visit(const ReturnStatement rs)
|
||||
{
|
||||
if (rs.expression.items.length != 1)
|
||||
if (!rs.expression || rs.expression.items.length != 1)
|
||||
return;
|
||||
UnaryExpression unary = cast(UnaryExpression) rs.expression.items[0];
|
||||
if (unary is null)
|
||||
|
@ -126,3 +126,13 @@ class C { bool empty() { return false; } } // [warn]: %1$s
|
|||
|
||||
stderr.writeln("Unittest for IncorrectInfiniteRangeCheck passed.");
|
||||
}
|
||||
|
||||
// test for https://github.com/dlang-community/D-Scanner/issues/656
|
||||
// unittests are skipped but D-Scanner sources are self checked
|
||||
version(none) struct Foo
|
||||
{
|
||||
void empty()
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue