mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2024-12-29 12:20:41 +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]; };
|
= [](LuaUtil::InputAction::Registry& registry, std::string_view key) { return registry[key]; };
|
||||||
{
|
{
|
||||||
auto pairs = [](LuaUtil::InputAction::Registry& registry) {
|
auto pairs = [](LuaUtil::InputAction::Registry& registry) {
|
||||||
auto next = [](LuaUtil::InputAction::Registry& registry, std::string_view key)
|
auto next
|
||||||
-> sol::optional<std::tuple<std::string_view, LuaUtil::InputAction::Info>> {
|
= [](LuaUtil::InputAction::Registry& registry,
|
||||||
std::optional<std::string_view> nextKey(registry.nextKey(key));
|
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())
|
if (!nextKey.has_value())
|
||||||
return sol::nullopt;
|
return sol::nullopt;
|
||||||
else
|
else
|
||||||
@ -102,9 +103,10 @@ namespace MWLua
|
|||||||
= [](LuaUtil::InputTrigger::Registry& registry, std::string_view key) { return registry[key]; };
|
= [](LuaUtil::InputTrigger::Registry& registry, std::string_view key) { return registry[key]; };
|
||||||
{
|
{
|
||||||
auto pairs = [](LuaUtil::InputTrigger::Registry& registry) {
|
auto pairs = [](LuaUtil::InputTrigger::Registry& registry) {
|
||||||
auto next = [](LuaUtil::InputTrigger::Registry& registry, std::string_view key)
|
auto next
|
||||||
-> sol::optional<std::tuple<std::string_view, LuaUtil::InputTrigger::Info>> {
|
= [](LuaUtil::InputTrigger::Registry& registry,
|
||||||
std::optional<std::string_view> nextKey(registry.nextKey(key));
|
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())
|
if (!nextKey.has_value())
|
||||||
return sol::nullopt;
|
return sol::nullopt;
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user