summaryrefslogtreecommitdiffhomepage
path: root/Stars45/FighterAI.cpp
diff options
context:
space:
mode:
authorFWoltermann@gmail.com <FWoltermann@gmail.com@076cb2c4-205e-83fd-5cf3-1be9aa105544>2012-06-24 18:55:14 +0000
committerFWoltermann@gmail.com <FWoltermann@gmail.com@076cb2c4-205e-83fd-5cf3-1be9aa105544>2012-06-24 18:55:14 +0000
commit88a7e24d44695f49e1250a9314f03bf4c6e1cff8 (patch)
treeb02bac4b5735ede954eb48e0a2cfbead900f1fa5 /Stars45/FighterAI.cpp
parent05f1b225a03adeab4cda01a6c96595359464ac0e (diff)
downloadstarshatter-88a7e24d44695f49e1250a9314f03bf4c6e1cff8.zip
starshatter-88a7e24d44695f49e1250a9314f03bf4c6e1cff8.tar.gz
starshatter-88a7e24d44695f49e1250a9314f03bf4c6e1cff8.tar.bz2
A few PVS studio things5.1.87
Diffstat (limited to 'Stars45/FighterAI.cpp')
-rw-r--r--Stars45/FighterAI.cpp24
1 files changed, 13 insertions, 11 deletions
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)