fix(util/luaref): warnings produced by valgrind
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
a7027a1d00
commit
2372567a6e
2 changed files with 2 additions and 2 deletions
|
@ -42,7 +42,7 @@ void luaref::release() {
|
|||
}
|
||||
|
||||
luaref & luaref::operator=(luaref const & r) {
|
||||
if (m_ref == r.m_ref)
|
||||
if (m_state != nullptr && r.m_state != nullptr && m_ref == r.m_ref)
|
||||
return *this;
|
||||
if (m_state)
|
||||
luaL_unref(m_state, LUA_REGISTRYINDEX, m_ref);
|
||||
|
|
|
@ -15,7 +15,7 @@ class luaref {
|
|||
lua_State * m_state;
|
||||
int m_ref;
|
||||
public:
|
||||
luaref():m_state(nullptr) {}
|
||||
luaref():m_state(nullptr), m_ref(0) {}
|
||||
/**
|
||||
\brief Create a reference to the Lua object at position \c i on \c L stack.
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue