From 88a7e24d44695f49e1250a9314f03bf4c6e1cff8 Mon Sep 17 00:00:00 2001 From: "FWoltermann@gmail.com" Date: Sun, 24 Jun 2012 18:55:14 +0000 Subject: A few PVS studio things --- Stars45/FighterAI.cpp | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'Stars45/FighterAI.cpp') diff --git a/Stars45/FighterAI.cpp b/Stars45/FighterAI.cpp index 0102f21..835bd00 100644 --- a/Stars45/FighterAI.cpp +++ b/Stars45/FighterAI.cpp @@ -1604,20 +1604,22 @@ FighterAI::EvadeThreat() else { evading = true; - - if (target == threat) { - if (target->Type() == SimObject::SIM_SHIP) { - Ship* tgt_ship = (Ship*) target; - if (tgt_ship->GetTrigger(0)) { - SetTarget(0); - drop_time = 3; + + if (target != nullptr) { + if (target == threat) { + if (target->Type() == SimObject::SIM_SHIP) { + Ship* tgt_ship = (Ship*) target; + if (tgt_ship->GetTrigger(0)) { + SetTarget(0); + drop_time = 3; + } } } - } - else if (target && threat_dist < threat_range / 2) { - SetTarget(0); - drop_time = 3; + else if (target && threat_dist < threat_range / 2) { + SetTarget(0); + drop_time = 3; + } } if (target) -- cgit v1.1