summaryrefslogtreecommitdiffhomepage
path: root/Stars45/FighterAI.cpp
diff options
context:
space:
mode:
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)