Minor check in ~ScopedHandle()

This commit is contained in:
David Capello 2014-11-30 21:02:41 -03:00
parent b1d9d82fbf
commit a3ffe68f2d

View File

@ -14,7 +14,10 @@ namespace she {
class ScopedHandle {
public:
ScopedHandle(T* handle) : m_handle(handle) { }
~ScopedHandle() { m_handle->dispose(); }
~ScopedHandle() {
if (m_handle)
m_handle->dispose();
}
T* operator->() { return m_handle; }
operator T*() { return m_handle; }