Open johannes-tenschert opened 8 years ago
Currently I have the same issue, where nested fields trigger a StackOverflow exception. I am willing to submit the changes proposed by @johannes-tenschert as a pull-request if that was not done already. It would at least allow for the library to be used if nested fields are present without crashes.
I needed MERGEFIELDs as well as other nested fields (IF, special page numbering that doesn't need anything from any mergefield). This either yielded a stack overflow in FieldRef.java:304 (to log! the error...) or sometimes no result for the mergefield.
I looked into it and found three reasons for the errors:
Since at least according to your forum you currently have no desire to support nested merge fields, I propose to just ignore and preserve other types of nested fields. I played around a little bit and this is the minimum of necessary changes I came up with:
At least for my templates this resolved the issue.