From 545b5f4d69e8156d7f1b9560170262303156bbf1 Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Wed, 12 Dec 2012 18:29:30 -0800 Subject: [PATCH] model: check for NULL parent Node 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 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/model.cc b/model.cc index 4d6e8af..843034d 100644 --- 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() || -- 2.34.1