Avoid printing Caveats title when output is empty

Feedback welcome. Closes #4878