mirror of
https://github.com/OpenMW/openmw.git
synced 2026-05-06 07:56:40 -04:00
Account for nullptrs
This commit is contained in:
@@ -32,7 +32,13 @@ namespace LuaUtil
|
||||
{
|
||||
}
|
||||
|
||||
ScriptsContainer* operator*() const noexcept { return *mWeakPtr.get(); }
|
||||
ScriptsContainer* operator*() const noexcept
|
||||
{
|
||||
if (auto ptr = mWeakPtr.get())
|
||||
return *ptr;
|
||||
// this shouldn't happen unless you use it after a move or try to be funny by constructing from nullptr
|
||||
return nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
inline auto operator<=>(const ScriptsContainerWeakPtr& lhs, const ScriptsContainerWeakPtr& rhs)
|
||||
|
||||
Reference in New Issue
Block a user