fix(util/luaref): warnings produced by valgrind

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2013-11-30 00:34:38 -08:00
parent a7027a1d00
commit 2372567a6e
2 changed files with 2 additions and 2 deletions

View file

@ -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);

View file

@ -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.
*/