That’s not a sin. That’s responding to environmental influences. Look, when you have some sexual thoughts it’s not a sin. If you intentionally indulge yourself in fantasies, well, discuss with confessor.
The world is full of horrible stuff. You are going to think about that when you hear about it. You are, if you are normal, going to have a very human reaction (I’m glad it wasn’t me) and then - even though it’s practically subconscious - be horrified at your response and then … then you start to wonder why God lets such awfulness happen. Why do the innocent suffer?
HOW CAN YOU LET THIS HAPPEN?!!
(I used to yell at God a lot.)
It’s not a sin. It’s part of what pushes us into a deeper communion with Him, seeking the answers, knowing He loves us, but trying to make sense of what seems senseless. At least, that’s what I decided.