Fixed for libreoffice crashes while opening file.

Change-Id: I85a16e4ef8d75f19250115d5522046a968d5fc91
Reviewed-on: https://gerrit.libreoffice.org/6760
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>