After sharing it in Facebook, a friend commented, "Just be there and be a good listener. Indonesians tend to give too much advice, whereas in Japan they don't even dare to say hi when they don't know what to say to you."
Finding balance is hard and when you're in an awkward position of hearing something sad or a tragedy that someone has just experienced, it's easy to get tempted to say something "helpful" (giving advice or saying hopeful words) even though the other person simply just wants you to be there and listen to you.
I find that the theory also works for infertility. I find that more often than not, when I tell people that we have no kids, they either ask why we don't have kids or they ask if we want to have kids or not (as in whether we're trying or not). And then most of them don't just stop there because they either assume we don't like kids or that we still want kids. And then they move on to giving us hopeful phrases like "You're still young, you still have time" or advice (adoption, etc.). There are some rare people out there, though, that don't pry and just accept a "no, we have no kids" without probing any further. :-)
I'm well aware that it's hard to know what to say especially when you don't know the person very well and each situation is different, but I think in most cases saying "sorry to hear that, do you want to talk about it because I'm ready to listen?" is enough. Unless the person specifically asks for your advice, then that's a whole different matter.
Anyhow, I hope you find the article useful. :-D