From 80ed1262bd654fe2de30389f97a985b5f2c1d783 Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Wed, 30 Oct 2024 21:51:06 +0100 Subject: add more containers and fix use after free --- frontend/cmd/search.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'frontend/cmd') 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 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; } -- cgit v1.2.3