Added error checking to handle the case when we have no file to display.