added a check to make sure there is text in the text file before generating a diagram