avoid NPE when the Document returned by the engine is null