Fixed prevent defects
authorsuhyung Eom <suhyung.eom@samsung.com>
Thu, 11 Jun 2015 10:07:52 +0000 (19:07 +0900)
committerYoonsang Lee <ysang114.lee@samsung.com>
Tue, 23 Jun 2015 02:23:02 +0000 (11:23 +0900)
< Prevent message >
Dereference null return value (NULL_RETURNS)

Signed-off-by: suhyung Eom <suhyung.eom@samsung.com>
Change-Id: Id84d90dcb1adca17b3fdc4f3b01ac86748306eab

dali/internal/event/render-tasks/render-task-impl.cpp
dali/internal/update/modeling/scene-graph-animatable-mesh.cpp
dali/public-api/common/dali-vector.cpp
dali/public-api/common/stage.cpp
dali/public-api/images/buffer-image.cpp
dali/public-api/object/property-value.cpp

index ff8c400..926354f 100644 (file)
@@ -224,10 +224,14 @@ void RenderTask::GetViewport( Viewport& viewPort ) const
     }
     else
     {
     }
     else
     {
-      Vector2 size( Stage::GetCurrent()->GetSize() );
-      viewPort.x = viewPort.y = 0;
-      viewPort.width = size.width;
-      viewPort.height = size.height;
+      Internal::Stage* stage = Internal::Stage::GetCurrent();
+      if ( stage )
+      {
+        Vector2 size( stage->GetSize() );
+        viewPort.x = viewPort.y = 0;
+        viewPort.width = size.width;
+        viewPort.height = size.height;
+      }
     }
   }
   else
     }
   }
   else
index 1d73b7d..e3e7d24 100644 (file)
@@ -65,6 +65,7 @@ void AnimatableMesh::UpdateMesh( BufferIndex updateBufferIndex )
 {
   // Copy properties to associated scenegraph mesh
   SceneGraph::Mesh* mesh(mResourceManager.GetMesh(mMeshId));
 {
   // Copy properties to associated scenegraph mesh
   SceneGraph::Mesh* mesh(mResourceManager.GetMesh(mMeshId));
+  DALI_ASSERT_DEBUG( mesh );
 
   // TODO: Should be double buffered - pass in buffer index
   MeshData& meshData = mesh->GetMeshData(Mesh::UPDATE_THREAD);
 
   // TODO: Should be double buffered - pass in buffer index
   MeshData& meshData = mesh->GetMeshData(Mesh::UPDATE_THREAD);
index fec1b2a..084515e 100644 (file)
@@ -76,6 +76,8 @@ void VectorBase::Reserve( SizeType capacity, SizeType elementSize )
   {
     const SizeType wholeAllocation = sizeof(SizeType) * 2u + capacity * elementSize;
     void* wholeData = (void*)malloc( wholeAllocation );
   {
     const SizeType wholeAllocation = sizeof(SizeType) * 2u + capacity * elementSize;
     void* wholeData = (void*)malloc( wholeAllocation );
+    DALI_ASSERT_ALWAYS( wholeData && "VectorBase::Reserve - Memory allocation failed" );
+
 #if defined( DEBUG_ENABLED )
     // in debug build this will help identify a vector of uninitialized data
     memset( wholeData, 0xaa, wholeAllocation );
 #if defined( DEBUG_ENABLED )
     // in debug build this will help identify a vector of uninitialized data
     memset( wholeData, 0xaa, wholeAllocation );
index 99d3c66..9a1e43f 100644 (file)
@@ -122,8 +122,10 @@ Vector2 Stage::GetDpi() const
 
 ObjectRegistry Stage::GetObjectRegistry() const
 {
 
 ObjectRegistry Stage::GetObjectRegistry() const
 {
-  Internal::ObjectRegistry& internal = Internal::Stage::GetCurrent()->GetObjectRegistry();
+  Internal::Stage* stage = Internal::Stage::GetCurrent();
+  DALI_ASSERT_ALWAYS( stage && "GetObjectRegistry() : Stage is null" );
 
 
+  Internal::ObjectRegistry& internal = stage->GetObjectRegistry();
   return ObjectRegistry(&internal);
 }
 
   return ObjectRegistry(&internal);
 }
 
index 1881a14..1bd44f5 100644 (file)
@@ -59,7 +59,10 @@ const BufferImage BufferImage::WHITE()
 {
   Internal::BufferImage* internal = new Internal::BufferImage(1,1,Pixel::RGBA8888, Dali::Image::NEVER);
   PixelBuffer* pBuf = internal->GetBuffer();
 {
   Internal::BufferImage* internal = new Internal::BufferImage(1,1,Pixel::RGBA8888, Dali::Image::NEVER);
   PixelBuffer* pBuf = internal->GetBuffer();
-  pBuf[0] = pBuf[1] = pBuf[2] = pBuf[3] = 0xFF;
+  if ( pBuf )
+  {
+    pBuf[0] = pBuf[1] = pBuf[2] = pBuf[3] = 0xFF;
+  }
   return BufferImage(internal);
 }
 
   return BufferImage(internal);
 }
 
index afa78c4..bb347ab 100644 (file)
@@ -870,7 +870,7 @@ Property::Value& Property::Value::GetItem(const int index, std::string& key) con
   if( Property::MAP == GetType() )
   {
     Property::Map *container = AnyCast<Property::Map>(&(mImpl->mValue));
   if( Property::MAP == GetType() )
   {
     Property::Map *container = AnyCast<Property::Map>(&(mImpl->mValue));
-    if( index < static_cast<int>(container->Count()) )
+    if( container && index < static_cast<int>(container->Count()) )
     {
       key = container->GetKey( index );
     }
     {
       key = container->GetKey( index );
     }