#vulnerable code 
                              @Override
  public NodeSet eval(final XPContext ctx) {
    ctx.local = new NodeSet(ctx.local.data.ids(index)[0], ctx);
    return ctx.local;
  } 
                            #location 3 
                            #vulnerability type NULL_DEREFERENCE
#fixed code
                              @Override
  public NodeSet eval(final XPContext ctx) {
    final IndexIterator it = ctx.local.data.ids(index);
    final IntList il = new IntList();
    while(it.more()) {
      ctx.checkStop();
      il.add(it.next());
    }
    ctx.local = new NodeSet(il.finish(), ctx);
    return ctx.local;
  }