google / intellij-gn-plugin

BSD 3-Clause "New" or "Revised" License
14 stars 11 forks source link

NPE on getPathLabel in PathUtils.kt #10

Closed bc-lee closed 3 years ago

bc-lee commented 3 years ago

It seems that codes for the Null Safety is needed in PathUtils.kt.

In file: LightVirtualFile: /redacted/src/build/config/ios/rules.gni

java.lang.NullPointerException: file.virtualFile.parent must not be null
    at com.google.idea.gn.util.PathUtilsKt.getPathLabel(PathUtils.kt:29)
    at com.google.idea.gn.GnLabel.toAbsolute(GnLabel.kt:82)
    at com.google.idea.gn.psi.builtin.GetLabelInfo.execute(GetLabelInfo.kt:21)
    at com.google.idea.gn.psi.GnPsiUtil.evaluatePrimary(GnPsiUtil.kt:61)
    at com.google.idea.gn.psi.GnPsiUtil.evaluate(GnPsiUtil.kt:27)
    at com.google.idea.gn.psi.GnPsiUtil.evaluate$default(GnPsiUtil.kt:22)
    at com.google.idea.gn.psi.impl.GnBinaryExprImpl.evaluate(GnBinaryExprImpl.kt:17)
    at com.google.idea.gn.psi.GnPsiUtil.evaluate(GnPsiUtil.kt:29)
    at com.google.idea.gn.psi.Visitor.evalExpr(Visitor.kt:116)
    at com.google.idea.gn.psi.Visitor.visitAssignment(Visitor.kt:160)
    at com.google.idea.gn.psi.Visitor.visitStatement(Visitor.kt:67)
    at com.google.idea.gn.psi.Visitor.visitStatementList(Visitor.kt:54)
    at com.google.idea.gn.psi.Visitor.visitCondition(Visitor.kt:136)
    at com.google.idea.gn.psi.Visitor.visitStatement(Visitor.kt:68)
    at com.google.idea.gn.psi.Visitor.visitStatementList(Visitor.kt:54)