mirror of
https://github.com/minetest/minetest.git
synced 2024-12-23 14:42:24 +01:00
Fix MSVC warning C4172 in ModifySafeMap::get (#14576)
This commit is contained in:
parent
98fd5bd453
commit
de8d80dee0
@ -369,7 +369,14 @@ public:
|
||||
return it->second;
|
||||
}
|
||||
auto it = m_values.find(key);
|
||||
return it == m_values.end() ? null_value : it->second;
|
||||
// This conditional block was converted from a ternary to ensure no
|
||||
// temporary values are created in evaluating the return expression,
|
||||
// which could cause a dangling reference.
|
||||
if (it != m_values.end()) {
|
||||
return it->second;
|
||||
} else {
|
||||
return null_value;
|
||||
}
|
||||
}
|
||||
|
||||
void put(const K &key, const V &value) {
|
||||
|
Loading…
Reference in New Issue
Block a user