If you are "repairing" a loaded firearm, you're doing it wrong. When you then shoot a four year old in the leg, it is not an accident. It's negligence all the way to the bottom.
First, you negligently failed to unload the firearm before you worked on it. Second, you negligently failed to keep the muzzle pointed in a safe direction. Now, on this third point, there is some small wiggle room that there was a genuine problem with the hammer and sear, but I would bet you a case of green tip .223 that if we had video, it would show a big ol' booger hook negligently engaging the bang switch just before that negligently pointed firearm send a projectile into a child.