Fix null pointer when scope.treeData hasn't been initialized yet