do the null check after getting the writer