Fix the case when getCurrentDocument returns null.