There are also physical safety switches, that date back to when weapons were first mounted on aircraft. Still present on modern armed aircraft. On the F16, a switch on the joystick controls selection of missiles or gun. One of it's positions is 'safe'. Obviously, that switch on the Belgian F16 wasn't in the safe position.
During WW2, there was a real problem with aircraft landing on a carrier, and the guns being discharged accidentally when the jolt of the landing and arresting caused the pilot's hand to hit the trigger on the joystick. Consequently, landing on a carrier with the gun switch not in the safe position was a serious transgression that would land a pilot in real trouble... you could kill a lot of deck crew if you discharged six .50 cal machine guns across the deck.
Even so, accidents can happen. On July 29, 1967, the USS Forrestal was seriously damaged when a Zuni air to ground missile was accidentally discharged from an F4 Phantom, striking an A4 Skyhawk waiting to take off. Piloting that Skyhawk was a young navy Lt, John S McCain. While the missile didn't detonate, it did tear open the Skyhawk's fuel tanks, starting a major fire, which led to a 1000 pound bomb detonating. 134 sailors died as a result, and hundreds were injured. It is believed that a short circuit of the firing mechanism led to the missile being discharged.
Aircraft carriers in particular can be quite dangerous. They combine high performance aircraft, high speed takeoffs and landings, plus all the fuel and munitions that the aircraft will carry, in a fairly small space. The fact that aircraft carriers don't blow up more often is a testament to the quality and discipline of it's crew.
Since the Forrestal incident, there have been no repeats of missiles being accidentally discharged on a carrier deck. Whatever measures were put in place after that, appear to have been effective.