Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ Template for new versions:
## New Features

## Fixes
- `autoclothing`: correct defect in validating material specification on command line
- `getplants`: added protective code to avoid misoperation when a plant has an invalid material (which should never happen, but...)

## Misc Improvements
Expand Down
9 changes: 6 additions & 3 deletions plugins/autoclothing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,19 +145,22 @@ struct ClothingRequirement {
return std::nullopt;
}

if (auto req = setItem(parameters[idx+1]); !req)
auto req = setItem(parameters[idx + 1]);

if (!req)
{
out << "Unrecognized item name or token: " << parameters[idx+1] << endl;
return std::nullopt;
}

else if (!validateMaterialCategory(*req)) {
req->material_category = material_category;

if (!validateMaterialCategory(*req)) {
out << parameters[idx] << " is not a valid material category for " << parameters[idx+1] << endl;
return std::nullopt;
}
else
{
req->material_category = material_category;
return req;
}
}
Expand Down
Loading