This is a classic beginner programming error. Everytime you delete an entry from the list of nodes it get's shorter, i.e. you have fewer indexes to deal with. For example, when index 0 is deleted, index 1 becomes the new index 0.
When you delete half the list, only half is left. And since your loop is counting up the next index is 1/2 the original entries + 1, which is exactly one more than exists. Resolve nodes shouldn't be returning a non-null value, but maybe something else is going on.
Change your loop to count down from the largest index. And also change to the "resolveNodes()" function, which returns a list of all the nodes that match. This is much more efficient.
When you delete half the list, only half is left. And since your loop is counting up the next index is 1/2 the original entries + 1, which is exactly one more than exists. Resolve nodes shouldn't be returning a non-null value, but maybe something else is going on.
Change your loop to count down from the largest index. And also change to the "resolveNodes()" function, which returns a list of all the nodes that match. This is much more efficient.
Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script