Fix NPE in PathQuery.