diff --git a/docs/changelog.txt b/docs/changelog.txt index 2e7a81412..0ab406af4 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -84,6 +84,7 @@ Template for new versions: - `sort`: when filtering out already-established temples in the location assignment screen, also filter out the "No specific deity" option if a non-denominational temple has already been established - RemoteServer: continue to accept connections as long as the listening socket is valid instead of closing the socket after the first disconnect - `buildingplan`: overlay and filter editor gui now uses ctrl-d to delete the filter to avoid conflict with increasing the filter's minimum quality (shift-x) +- `tailor`: fix crash on Linux where scanned unit is wearing damaged non-clothing (e.g. a crown) ## Misc Improvements - `buildingplan`: display how many items are available on the planner panel diff --git a/plugins/tailor.cpp b/plugins/tailor.cpp index ac71749ee..8dbe952b1 100644 --- a/plugins/tailor.cpp +++ b/plugins/tailor.cpp @@ -277,6 +277,9 @@ public: { if (inv->mode != df::unit_inventory_item::Worn) continue; + // skip non-clothing + if (!inv->item->isClothing()) + continue; if (inv->item->getWear() > 0) worn.push_back(inv->item); else @@ -288,9 +291,17 @@ public: for (auto w : worn) { + // skip armor + if (w->getEffectiveArmorLevel() > 0) + continue; + auto ty = w->getType(); - int isize = world->raws.creatures.all[w->getMakerRace()]->adultsize; + auto makerRace = w->getMakerRace(); + if (makerRace < 0 || makerRace >= (int16_t) world->raws.creatures.all.size()) + continue; + + int isize = world->raws.creatures.all[makerRace]->adultsize; std::string description; w->getItemDescription(&description, 0);