From c37f6b365f83fc09aa77dfb05c4543bcf6ee7bc8 Mon Sep 17 00:00:00 2001 From: graydon Date: Mon, 11 Jul 2005 21:47:39 +0000 Subject: 2005-07-11 Graydon Hoare * staptree.cxx (require): Generally handle null pointers in src. (deep_copy_visitor::visit_if_statement): Revert fche's change. --- staptree.cxx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'staptree.cxx') diff --git a/staptree.cxx b/staptree.cxx index 7192c4b8..706f4260 100644 --- a/staptree.cxx +++ b/staptree.cxx @@ -987,10 +987,13 @@ template static void require (deep_copy_visitor *v, T *dst, T src) { *dst = NULL; - v->targets.push(static_cast(dst)); - src->visit(v); - v->targets.pop(); - assert(*dst); + if (src != NULL) + { + v->targets.push(static_cast(dst)); + src->visit(v); + v->targets.pop(); + assert(*dst); + } } template static void @@ -1033,10 +1036,7 @@ deep_copy_visitor::visit_if_statement (if_statement* s) if_statement *n = new if_statement; require (this, &(n->condition), s->condition); require (this, &(n->thenblock), s->thenblock); - if (s->elseblock) - require (this, &(n->elseblock), s->elseblock); - else - n->elseblock = 0; + require (this, &(n->elseblock), s->elseblock); provide (this, n); } -- cgit