From: Ian Romanick Date: Thu, 1 Apr 2010 01:15:50 +0000 (-0700) Subject: Fix exec_list::move_nodes_to when the source list is empty X-Git-Tag: 062012170305~10660^2~625^2~472 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=acce380a3f6df56d44460c0b066b4791cc0f9732;p=profile%2Fivi%2Fmesa.git Fix exec_list::move_nodes_to when the source list is empty --- diff --git a/list.h b/list.h index 33b038c..054be7e 100644 --- a/list.h +++ b/list.h @@ -273,14 +273,18 @@ struct exec_list { */ void move_nodes_to(exec_list *target) { - target->head = head; - target->tail = NULL; - target->tail_pred = tail_pred; - - target->head->prev = (exec_node *) &target->head; - target->tail_pred->next = (exec_node *) &target->tail; - - make_empty(); + if (is_empty()) { + target->make_empty(); + } else { + target->head = head; + target->tail = NULL; + target->tail_pred = tail_pred; + + target->head->prev = (exec_node *) &target->head; + target->tail_pred->next = (exec_node *) &target->tail; + + make_empty(); + } } exec_list_iterator iterator()