Fixed crash in geo_remove_child()
This commit is contained in:
parent
b25bb84b48
commit
35d6fc0262
|
@ -578,12 +578,16 @@ struct GraphNode *geo_remove_child(struct GraphNode *graphNode) {
|
||||||
struct GraphNode *parent;
|
struct GraphNode *parent;
|
||||||
struct GraphNode **firstChild;
|
struct GraphNode **firstChild;
|
||||||
|
|
||||||
|
if (graphNode == NULL) { return NULL; }
|
||||||
|
|
||||||
parent = graphNode->parent;
|
parent = graphNode->parent;
|
||||||
firstChild = &parent->children;
|
firstChild = &parent->children;
|
||||||
|
|
||||||
// Remove link with siblings
|
// Remove link with siblings
|
||||||
|
if (graphNode->prev != NULL && graphNode->next != NULL) {
|
||||||
graphNode->prev->next = graphNode->next;
|
graphNode->prev->next = graphNode->next;
|
||||||
graphNode->next->prev = graphNode->prev;
|
graphNode->next->prev = graphNode->prev;
|
||||||
|
}
|
||||||
|
|
||||||
// If this node was the first child, a new first child must be chosen
|
// If this node was the first child, a new first child must be chosen
|
||||||
if (*firstChild == graphNode) {
|
if (*firstChild == graphNode) {
|
||||||
|
|
Loading…
Reference in New Issue