[4.0] Fix SVACE issue 31/150231/1 accepted/tizen/4.0/unified/20170918.093549 submit/tizen_4.0/20170915.030644 submit/tizen_4.0/20170915.041056
authorSeoyeon Kim <seoyeon2.kim@samsung.com>
Tue, 12 Sep 2017 08:03:07 +0000 (17:03 +0900)
committerSeoyeon Kim <seoyeon2.kim@samsung.com>
Fri, 15 Sep 2017 01:41:35 +0000 (10: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(