Fix nullptr deref evaluating train in slot conditional order with no slot
See: #360
This commit is contained in:
@@ -2814,6 +2814,7 @@ VehicleOrderID ProcessConditionalOrder(const Order *order, const Vehicle *v, boo
|
|||||||
}
|
}
|
||||||
case OCV_TRAIN_IN_SLOT: {
|
case OCV_TRAIN_IN_SLOT: {
|
||||||
TraceRestrictSlot* slot = TraceRestrictSlot::GetIfValid(order->GetXData());
|
TraceRestrictSlot* slot = TraceRestrictSlot::GetIfValid(order->GetXData());
|
||||||
|
if (slot != nullptr) {
|
||||||
bool occupant = slot->IsOccupant(v->index);
|
bool occupant = slot->IsOccupant(v->index);
|
||||||
if (occ == OCC_EQUALS || occ == OCC_NOT_EQUALS) {
|
if (occ == OCC_EQUALS || occ == OCC_NOT_EQUALS) {
|
||||||
if (!occupant && !dry_run) {
|
if (!occupant && !dry_run) {
|
||||||
@@ -2821,7 +2822,8 @@ VehicleOrderID ProcessConditionalOrder(const Order *order, const Vehicle *v, boo
|
|||||||
}
|
}
|
||||||
occ = (occ == OCC_EQUALS) ? OCC_IS_TRUE : OCC_IS_FALSE;
|
occ = (occ == OCC_EQUALS) ? OCC_IS_TRUE : OCC_IS_FALSE;
|
||||||
}
|
}
|
||||||
if (slot != nullptr) skip_order = OrderConditionCompare(occ, occupant, value);
|
skip_order = OrderConditionCompare(occ, occupant, value);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case OCV_FREE_PLATFORMS: {
|
case OCV_FREE_PLATFORMS: {
|
||||||
|
Reference in New Issue
Block a user