mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2024-12-28 18:18:52 +00:00
Fix memory safety of actions/triggers iteration
This commit is contained in:
parent
2df8c13525
commit
ab628ea12a
@ -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::tuple<std::string_view, LuaUtil::InputAction::Info>> {
|
||||
std::optional<std::string_view> nextKey(registry.nextKey(key));
|
||||
auto next
|
||||
= [](LuaUtil::InputAction::Registry& registry,
|
||||
std::string_view key) -> sol::optional<std::tuple<std::string, LuaUtil::InputAction::Info>> {
|
||||
std::optional<std::string> 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::tuple<std::string_view, LuaUtil::InputTrigger::Info>> {
|
||||
std::optional<std::string_view> nextKey(registry.nextKey(key));
|
||||
auto next
|
||||
= [](LuaUtil::InputTrigger::Registry& registry,
|
||||
std::string_view key) -> sol::optional<std::tuple<std::string, LuaUtil::InputTrigger::Info>> {
|
||||
std::optional<std::string> nextKey(registry.nextKey(key));
|
||||
if (!nextKey.has_value())
|
||||
return sol::nullopt;
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user