ensure messagebox is only displayed when there is something to display