I think the ref didnt take the situation fully into account and made a quick descion that there was a player on the line, however it it was the other way round, defender making the tackle and goalkeeper on the line I think he would have sent the player off.
I heard many people saying oh but...