summaryrefslogtreecommitdiff
path: root/core/gmathlib.c
diff options
context:
space:
mode:
Diffstat (limited to 'core/gmathlib.c')
-rw-r--r--core/gmathlib.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/core/gmathlib.c b/core/gmathlib.c
index 189ba08..879f999 100644
--- a/core/gmathlib.c
+++ b/core/gmathlib.c
@@ -293,11 +293,13 @@ gmathsymbol_set_value (GMathSymbol *symbol, gchar *value)
void
gmathsymbol_set_child (GMathSymbol *symbol, GMathSymbol *child, int index)
{
- if (!symbol || child->parent || index >= symbol->template->children_count)
+ if (!symbol || (child && child->parent) ||
+ index >= symbol->template->children_count)
return;
symbol->children[index] = child;
- child->parent = symbol;
+ if (child)
+ child->parent = symbol;
}
/* Get a Symbol's child */