boolean validLevelSeries(TreeInfo *node)
{
- return (node != NULL && !node->node_group && !node->parent_link);
+ // in a number of cases, tree node is no valid level set
+ if (node == NULL || node->node_group || node->parent_link || node->is_copy)
+ return FALSE;
+
+ return TRUE;
+}
+
+TreeInfo *getValidLevelSeries(TreeInfo *node, TreeInfo *default_node)
+{
+ if (validLevelSeries(node))
+ return node;
+ else if (node->is_copy)
+ return getTreeInfoFromIdentifier(leveldir_first, node->identifier);
+ else
+ return getFirstValidTreeInfoEntry(default_node);
}
TreeInfo *getFirstValidTreeInfoEntry(TreeInfo *node)
if (node_group)
return node_group;
}
- else if (!node->parent_link)
+ else if (!node->parent_link && !node->is_copy)
{
if (strEqual(identifier, node->identifier))
return node;
void removeTreeInfo(TreeInfo **);
int numTreeInfo(TreeInfo *);
boolean validLevelSeries(TreeInfo *);
+TreeInfo *getValidLevelSeries(TreeInfo *, TreeInfo *);
TreeInfo *getFirstValidTreeInfoEntry(TreeInfo *);
TreeInfo *getTreeInfoFirstGroupEntry(TreeInfo *);
int numTreeInfoInGroup(TreeInfo *);
return;
}
- // leveldir_current may be invalid (level group, parent link)
- if (!validLevelSeries(leveldir_current))
- leveldir_current = getFirstValidTreeInfoEntry(leveldir_last_valid);
+ // leveldir_current may be invalid (level group, parent link, node copy)
+ leveldir_current = getValidLevelSeries(leveldir_current, leveldir_last_valid);
if (leveldir_current != leveldir_last_valid)
{