dastworx, prevent unsafe access

This commit is contained in:
Basile Burg 2017-06-12 01:45:51 +02:00
parent e79930576b
commit 4a0e037c51
No known key found for this signature in database
GPG Key ID: 1868039F415CB8CF
2 changed files with 16 additions and 4 deletions

View File

@ -80,8 +80,14 @@ private final class ImportLister: ASTVisitor
override void visit(const ConditionalDeclaration decl)
{
const VersionCondition ver = decl.compileCondition.versionCondition;
if (ver is null || ver.token.text !in badVersions)
bool acc = true;
if (decl.compileCondition)
{
const ver = decl.compileCondition.versionCondition;
if (ver && ver.token.text in badVersions)
acc = false;
}
if (acc)
decl.accept(this);
}

View File

@ -35,8 +35,14 @@ private final class MainFunctionDetector: ASTVisitor
override void visit(const ConditionalDeclaration decl)
{
const VersionCondition ver = decl.compileCondition.versionCondition;
if (ver is null || ver.token.text !in badVersions)
bool acc = true;
if (decl.compileCondition)
{
const ver = decl.compileCondition.versionCondition;
if (ver && ver.token.text in badVersions)
acc = false;
}
if (acc)
decl.accept(this);
}