Exception when nth-child is not properly specified
Pure Java HTML / CSS rendering engine
Status: Beta
Brought to you by:
radkovo
Encountered this erroneous CSS rule:
div:nth-child {background: red}
The parameter to nth-child is missing and throws an exception:
java.lang.NullPointerException at cz.vutbr.web.csskit.SelectorImpl$PseudoPageImpl.positionMatches(SelectorImpl.java:509) at cz.vutbr.web.csskit.SelectorImpl$PseudoPageImpl.matches(SelectorImpl.java:470) at cz.vutbr.web.csskit.SelectorImpl.matches(SelectorImpl.java:115) at cz.vutbr.web.domassign.Analyzer.elementSelectorMatches(Analyzer.java:324) at cz.vutbr.web.domassign.DirectAnalyzer.matchSelector(DirectAnalyzer.java:206) at cz.vutbr.web.domassign.DirectAnalyzer.getDeclarationsForElement(DirectAnalyzer.java:156) at cz.vutbr.web.domassign.DirectAnalyzer.getElementStyle(DirectAnalyzer.java:73) at cz.vutbr.web.domassign.DirectAnalyzer.getElementStyle(DirectAnalyzer.java:91)
Anonymous
Ok, hopefully fixed by this commit .
Added a test-case for this: https://github.com/radkovo/jStyleParser/pull/10
... and verified that your commit fixes it.
Closed in 1.20.