From ab628ea12a1ed97c3096d7d29bad0c3f1e6a231d Mon Sep 17 00:00:00 2001 From: uramer Date: Wed, 7 Aug 2024 19:20:12 +0200 Subject: [PATCH] Fix memory safety of actions/triggers iteration --- apps/openmw/mwlua/inputbindings.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/apps/openmw/mwlua/inputbindings.cpp b/apps/openmw/mwlua/inputbindings.cpp index dbe79ca377..d26de4336a 100644 --- a/apps/openmw/mwlua/inputbindings.cpp +++ b/apps/openmw/mwlua/inputbindings.cpp @@ -71,9 +71,10 @@ namespace MWLua = [](LuaUtil::InputAction::Registry& registry, std::string_view key) { return registry[key]; }; { auto pairs = [](LuaUtil::InputAction::Registry& registry) { - auto next = [](LuaUtil::InputAction::Registry& registry, std::string_view key) - -> sol::optional> { - std::optional nextKey(registry.nextKey(key)); + auto next + = [](LuaUtil::InputAction::Registry& registry, + std::string_view key) -> sol::optional> { + std::optional nextKey(registry.nextKey(key)); if (!nextKey.has_value()) return sol::nullopt; else @@ -102,9 +103,10 @@ namespace MWLua = [](LuaUtil::InputTrigger::Registry& registry, std::string_view key) { return registry[key]; }; { auto pairs = [](LuaUtil::InputTrigger::Registry& registry) { - auto next = [](LuaUtil::InputTrigger::Registry& registry, std::string_view key) - -> sol::optional> { - std::optional nextKey(registry.nextKey(key)); + auto next + = [](LuaUtil::InputTrigger::Registry& registry, + std::string_view key) -> sol::optional> { + std::optional nextKey(registry.nextKey(key)); if (!nextKey.has_value()) return sol::nullopt; else