Following the basic safety rules would have prevented it.
It did not happen at home.
One has to train and gun proof your children. I was rasied with easy axcess to many guns we never handled them with out permisson there were 8 of us.
We were taught early and often about firearms. We were hunting by are selfs by the time we were 8yoa. I shot my frist grouse with a 20ga 870 when I was 9 just me and the dog.
If we wanted to look at a gun just ask and we were shown it how to check if it was loaded and never ever point it at another person.
That one thing I had to over come after I became a LEO If was hard to get use to pointing loaded ready to use firearms at people. That went against all my childhood training.
My own children were shown firearms from a fairly early age as soon as they could walk. They were given toy guns very early and explained the differants.
From the time they were 5 on they shot guns on a regular basics. I made it a point to take them out shooting several times a month. Not hard when one can walk out the front and back doors and shoot. They recived a bb gun at age 5 and a 22 at 12.
By the time they were 8 or 10 they could pick up many differant kinds of rifles, shotguns, handguns and make sure that they were unloaded or loaded.
When they turned 18 they were given a semi auto 9mm and a double action revolver for turning into upstanding citizens.
They now both own many guns and have CCW permits
Train early and often.