Fixes NPE on document read of non-existing directory.

Only occurs in test cases, but thought I better cover it.