xref can be null so check for it before checking we went out of bounds

Fixes bug 14549
1 file changed