model: check for NULL parent Node
authorBrian Norris <banorris@uci.edu>
Thu, 13 Dec 2012 02:29:30 +0000 (18:29 -0800)
committerBrian Norris <banorris@uci.edu>
Thu, 13 Dec 2012 23:52:17 +0000 (15:52 -0800)
I'm editing the NodeStack to eliminate the empty Node. So we should
check to ensure that the Node has a parent before using it.

model.cc

index 4d6e8af72b388dedf2502b13d732b9d801365a94..843034d31acec815eb8c8943d6910eb074103f0b 100644 (file)
--- a/model.cc
+++ b/model.cc
@@ -254,6 +254,7 @@ Thread * ModelChecker::get_next_thread(ModelAction *curr)
                        tid = next->get_tid();
                        node_stack->pop_restofstack(2);
                } else {
+                       ASSERT(prevnode);
                        /* Make a different thread execute for next step */
                        scheduler->add_sleep(get_thread(next->get_tid()));
                        tid = prevnode->get_next_backtrack();
@@ -1295,7 +1296,7 @@ void ModelChecker::check_curr_backtracking(ModelAction *curr)
        Node *currnode = curr->get_node();
        Node *parnode = currnode->get_parent();
 
-       if (!parnode->backtrack_empty() ||
+       if ((parnode && !parnode->backtrack_empty()) ||
                         !currnode->misc_empty() ||
                         !currnode->read_from_empty() ||
                         !currnode->future_value_empty() ||