From 9fe0f14ceaf30ca99ce7a58aba8c49bb9b351f71 Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Thu, 28 Feb 2013 22:46:25 -0800 Subject: [PATCH] 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). --- nodestack.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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(); } -- 2.34.1