There was a massive gamma-ray burst which occurred about 50,000 light years away which was detected in 2004. Apparently it was the largest galactic flash ever recorded, and apparently it also hit earth. It altered the ozone for a short period of time, but like everything, that passed.

Needless, gamma-ray bursts don't matter, considering that the burst that hit in 2004 would be about how bad a blast would be. There are no magnetars close enough that if one were to trigger an explosion, it would do any damage. Now if there were one at least 10,000 light years away, then we could have a problem, but luckily for us, earth is at a very calm spot in the galaxy.

The nearest megnetar is located 16,000 light years away. If that one bursts, there would be effects, but nothing serious.