Maybe it's just a "me" thing, but I never know what to say or do in such a situation. Unless I have direct personal experience with a similar situation, I'm basically just like, "that sucks :("
I never know what people want/need from me when they are upset unless they explicitly tell me.