Although well intentioned, saying this directly after delivering bad news asks for an emotional assessment before the person has had time to process the information. It may also sound contrived.