chrsan/css-selectors

NullPointerException for some invalid input

Opened this issue · 0 comments

Trying to use a selector like "a[b c d]", I get a NullPointerException, down in SelectorMatcher.matchesAttributeSelector:

@Test
public void testBadInput() {
    List<Node> nodes = new Selectors<>(document).querySelectorAll("div[id,foo]");
    assertEquals(0, nodes.size());

    nodes = new Selectors<>(document).querySelectorAll("div[id and foo]");
    assertEquals(0, nodes.size());
}