Avoid Svace MEMORY_LEAK warning in callback.cpp
[platform/core/uifw/dali-core.git] / dali / public-api / signals / callback.cpp
index 841b1df..6bbf33f 100644 (file)
@@ -45,18 +45,24 @@ CallbackBase::CallbackBase( void* object, MemberFunction function, Dispatcher di
 : mMemberFunction( function )
 {
   mImpl = new CallbackBase::Impl;
-  mImpl->mObjectPointer = object;
-  mImpl->mMemberFunctionDispatcher = dispatcher;
-  mImpl->mDestructorDispatcher = NULL; // object is not owned
+  if( mImpl )
+  {
+    mImpl->mObjectPointer = object;
+    mImpl->mMemberFunctionDispatcher = dispatcher;
+    mImpl->mDestructorDispatcher = NULL; // object is not owned
+  }
 }
 
 CallbackBase::CallbackBase( void* object, MemberFunction function, Dispatcher dispatcher, Destructor destructor )
 : mMemberFunction( function )
 {
   mImpl = new CallbackBase::Impl;
-  mImpl->mObjectPointer = object;
-  mImpl->mMemberFunctionDispatcher = dispatcher;
-  mImpl->mDestructorDispatcher = destructor; // object is owned
+  if( mImpl )
+  {
+    mImpl->mObjectPointer = object;
+    mImpl->mMemberFunctionDispatcher = dispatcher;
+    mImpl->mDestructorDispatcher = destructor; // object is owned
+  }
 }
 
 void CallbackBase::Reset()