Fix SVACE issue 15/149415/2
authorSeoyeon Kim <seoyeon2.kim@samsung.com>
Tue, 12 Sep 2017 08:03:07 +0000 (17:03 +0900)
committerSeoyeon Kim <seoyeon2.kim@samsung.com>
Wed, 13 Sep 2017 10:41:58 +0000 (19:41 +0900)
- Fix to prevent 'name' from passing a null pointer to a 'std::string',
because it would result in dereferencing a null pointer.

Change-Id: If01974fa77662db75480962ff52373a6cc403b17
Signed-off-by: Seoyeon Kim <seoyeon2.kim@samsung.com>
dali-toolkit/internal/visuals/text/text-visual.cpp

index 7ce455e..889b57d 100644 (file)
@@ -74,7 +74,11 @@ std::string GetHorizontalAlignment( Toolkit::Text::Layout::HorizontalAlignment a
                                                                                                 HORIZONTAL_ALIGNMENT_STRING_TABLE,
                                                                                                 HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT );
 
-  return std::string( name );
+  if( name )
+  {
+    return std::string( name );
+  }
+  return std::string();
 }
 
 std::string GetVerticalAlignment( Toolkit::Text::Layout::VerticalAlignment alignment )
@@ -83,7 +87,11 @@ std::string GetVerticalAlignment( Toolkit::Text::Layout::VerticalAlignment align
                                                                                                 VERTICAL_ALIGNMENT_STRING_TABLE,
                                                                                                 VERTICAL_ALIGNMENT_STRING_TABLE_COUNT );
 
-  return std::string( name );
+  if( name )
+  {
+    return std::string( name );
+  }
+  return std::string();
 }
 
 const char* VERTEX_SHADER = DALI_COMPOSE_SHADER(