summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/autoreplace_cmd.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/autoreplace_cmd.cpp b/src/autoreplace_cmd.cpp
index f0a8f171a..ef5e0d70f 100644
--- a/src/autoreplace_cmd.cpp
+++ b/src/autoreplace_cmd.cpp
@@ -93,7 +93,7 @@ static CargoID GetNewCargoTypeForReplace(Vehicle *v, EngineID engine_type)
if (new_cargo_type == CT_INVALID) return CT_NO_REFIT; // Don't try to refit an engine with no cargo capacity
- if (v->cargo_type == new_cargo_type || CanRefitTo(engine_type, v->cargo_type)) {
+ if (v->cargo_cap != 0 && (v->cargo_type == new_cargo_type || CanRefitTo(engine_type, v->cargo_type))) {
if (VerifyAutoreplaceRefitForOrders(v, engine_type)) {
return v->cargo_type == new_cargo_type ? (CargoID)CT_NO_REFIT : v->cargo_type;
} else {