Prevent error when trying to find a view cutting point at end of document

Issue #2528