Avoid undefined null pointer dereferences

...as observed during CppunitTest_sw_rtfexport under -fsanitize=undefined

Change-Id: I8f488188e233c1814a7b4bb3d21e7398d7d7c15a