Yes that will block dumb spammers who don’t know how to face their http-referrer header plus it will block anyone else who doesn’t set their http-referrer for whatever reason.
As discussed in another thread here recently that check is very easy for a spammer to get around.