diff --git a/res/core/messages.xml b/res/core/messages.xml index 0cd66ca08..1e4e977e0 100644 --- a/res/core/messages.xml +++ b/res/core/messages.xml @@ -30,7 +30,7 @@ - + @@ -38,7 +38,7 @@ - + @@ -46,7 +46,7 @@ - + diff --git a/src/economy.c b/src/economy.c index dc7e6148b..baba6c1ac 100644 --- a/src/economy.c +++ b/src/economy.c @@ -1666,7 +1666,7 @@ static void buy(unit * u, econ_request ** buyorders, struct order *ord) return; } } - if (r_demand(r, ltype)) { + if (!r->land || r_demand(r, ltype)) { ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "luxury_notsold", "")); return; } @@ -1708,6 +1708,7 @@ static void expandselling(region * r, econ_request * sellorders, int limit) static int bt_cache; static const struct building_type *castle_bt, *harbour_bt, *caravan_bt; + assert(r->land); if (bt_changed(&bt_cache)) { castle_bt = bt_find("castle"); harbour_bt = bt_find("harbour"); @@ -1977,7 +1978,7 @@ static bool sell(unit * u, econ_request ** sellorders, struct order *ord) econ_request *o; int k, available; - if (!r_demand(r, ltype)) { + if (!r->land || !r_demand(r, ltype)) { cmistake(u, ord, 263, MSG_COMMERCE); return false; } diff --git a/src/kernel/region.c b/src/kernel/region.c index 7cb52c201..29f7222e1 100644 --- a/src/kernel/region.c +++ b/src/kernel/region.c @@ -716,7 +716,10 @@ const item_type *r_luxury(const region * r) int r_demand(const region * r, const luxury_type * ltype) { - struct demand *d = r->land->demands; + struct demand *d; + + assert(r && r->land); + d = r->land->demands; while (d && d->type != ltype) d = d->next; if (!d)