Fix crash on broken documents

Fixes bug #101524
1 file changed