From cecd643ab2de3e4dbd69e76c58b928ab2aa2a80f Mon Sep 17 00:00:00 2001 From: Teddy Date: Wed, 7 Aug 2013 00:56:37 +0800 Subject: list checking fix --- main.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index eae0597..68f6c33 100644 --- a/main.cpp +++ b/main.cpp @@ -8,10 +8,11 @@ #ifdef DEBUG extern Cons *empty_list; void tree_print(Cons *ptr) { - if (!ptr || ptr == empty_list) return; ptr->_debug_print(); - tree_print(dynamic_cast(ptr->car)); - tree_print(TO_CONS(ptr->cdr)); + if (ptr->car->is_cons_obj()) + tree_print(TO_CONS(ptr->car)); + if (ptr->cdr->is_cons_obj()) + tree_print(TO_CONS(ptr->cdr)); } #endif -- cgit v1.2.3