fixing a null-pointer error

the clearErrorDisplay() method was also called when the document was null but was prepared to handle it. It now is.