diff options
| author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-10-30 21:51:06 +0100 |
|---|---|---|
| committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-10-30 21:51:06 +0100 |
| commit | 80ed1262bd654fe2de30389f97a985b5f2c1d783 (patch) | |
| tree | 020b1b63d637e07882c9a10d81fe2ac04ce82bcc /frontend/cmd | |
| parent | c45a436fc594101f676cfabe90225d825d935fec (diff) | |
add more containers and fix use after free
Diffstat (limited to 'frontend/cmd')
| -rw-r--r-- | frontend/cmd/search.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/frontend/cmd/search.cpp b/frontend/cmd/search.cpp index f10709a..16e4592 100644 --- a/frontend/cmd/search.cpp +++ b/frontend/cmd/search.cpp @@ -7,14 +7,17 @@ using namespace std; FollowupAction Player::cmd_search(string &) { bool found = false; + List<Object *> to_unhide; for (Object * object : this->location.get_hidden_objects()) { if (!found) lprtf("Je vindt:\n"); lprtf("- %s\n", object->get_displayname().c_str()); - this->location.unhide_object(object); + to_unhide.push_back(object); found = true; } if (!found) lprtf("Je hebt niks gevonden.\n"); + for (Object * object : to_unhide) + this->location.unhide_object(object); return FollowupAction::UPDATE; } |