NXP-12495: avoid NPE when currentDocument is null