From: Brian Norris Date: Fri, 1 Mar 2013 06:46:25 +0000 (-0800) Subject: nodestack: get_read_from_promise() never returns NULL X-Git-Tag: oopsla2013~199 X-Git-Url: http://plrg.eecs.uci.edu/git/?p=model-checker.git;a=commitdiff_plain;h=9fe0f14ceaf30ca99ce7a58aba8c49bb9b351f71 nodestack: get_read_from_promise() never returns NULL If the read_from_promise_idx is out of bounds, this is an error. We should not return NULL (and in fact, our caller never expects us to return NULL). --- diff --git a/nodestack.cc b/nodestack.cc index 00cc30f..515a2d3 100644 --- a/nodestack.cc +++ b/nodestack.cc @@ -458,8 +458,7 @@ void Node::add_read_from_promise(const ModelAction *reader) */ Promise * Node::get_read_from_promise() const { - if (read_from_promise_idx < 0 || read_from_promise_idx >= ((int)read_from_promises.size())) - return NULL; + ASSERT(read_from_promise_idx >= 0 && read_from_promise_idx < ((int)read_from_promises.size())); return read_from_promises[read_from_promise_idx]->get_reads_from_promise(); }