Enable json tree dump to work with empty arrays 14/112214/1
authorAgnelo Vaz <agnelo.vaz@samsung.com>
Fri, 27 Jan 2017 17:54:10 +0000 (17:54 +0000)
committerAgnelo Vaz <agnelo.vaz@samsung.com>
Fri, 27 Jan 2017 17:54:10 +0000 (17:54 +0000)
If the json contains an empty array it would crash as there was no check before dereferencing a pointer.

Below constant section should be added to json to get debug output

  "constants":
  {

    "CONFIG_SCRIPT_LOG_LEVEL":"Verbose",
    "DUMP_TREE":1
  },

Change-Id: I9584fa0c4202ea7907a9235cdfb81264ab3596c6

dali-toolkit/internal/builder/tree-node-manipulator.cpp

index 4357cb8..9567306 100644 (file)
@@ -398,7 +398,7 @@ void TreeNodeManipulator::DoWrite(const TreeNode *value, std::ostream& output, i
     {
       bool groupMyChildren = false;
 
-      if( TreeNode::ARRAY == value->GetType() &&
+      if( TreeNode::ARRAY == value->GetType() && value->mFirstChild &&
           ( TreeNode::INTEGER == value->mFirstChild->GetType() ||
             TreeNode::FLOAT   == value->mFirstChild->GetType() ) )
       {