From 1ecf7c1e54e766b5ef5fadc2ab52e1640229055e Mon Sep 17 00:00:00 2001
From: Allanis <allanis@saracraft.net>
Date: Tue, 19 Feb 2013 23:02:42 +0000
Subject: [PATCH] [Fix] Primary weapons where borked on checking for
 ammunition.

---
 src/pilot.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/pilot.c b/src/pilot.c
index 493494c..caa21ee 100644
--- a/src/pilot.c
+++ b/src/pilot.c
@@ -127,7 +127,8 @@ void pilot_shoot(Pilot* p, const unsigned int target, const int secondary) {
 
 static void pilot_shootWeapon(Pilot* p, PilotOutfit* w, const unsigned int t) {
   // WElll... Trying to shoot when you have no ammo?? FUUU
-  int quantity = outfit_isAmmo(w->outfit) ? p->secondary->quantity : w->quantity;
+  int quantity = (outfit_isAmmo(w->outfit) && p->secondary) ?
+        p->secondary->quantity : w->quantity;
   // Check to see if weapon is ready.
   if((SDL_GetTicks() - w->timer) < (w->outfit->delay / quantity)) return;