From f5be6e7ab5de9790fd0f27ad7ff69d8b8bbe6851 Mon Sep 17 00:00:00 2001 From: paladin-t Date: Thu, 28 Jan 2016 11:17:25 +0800 Subject: [PATCH] *fixed a crash bug when skipping a struct. --- HISTORY | 3 +++ core/my_basic.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/HISTORY b/HISTORY index e818025..480a24e 100755 --- a/HISTORY +++ b/HISTORY @@ -1,3 +1,6 @@ +Jan. 28 2016 +Fixed a crash bug when skipping a struct + Jan. 27 2016 Removed the MB_ENABLE_GC macro Refactored initial reference count diff --git a/core/my_basic.c b/core/my_basic.c index 6be8e2b..d379b0d 100755 --- a/core/my_basic.c +++ b/core/my_basic.c @@ -1627,7 +1627,7 @@ static int _close_coll_lib(mb_interpreter_t* s); _ls_node_t* ast = 0; static int i = 0; ++i; \ printf("Unaccessable function called %d times.\n", i); \ ast = (_ls_node_t*)(*(__l)); \ - _handle_error_on_obj((__s), SE_RN_WRONG_FUNCTION_REACHED, 0, DON(ast), MB_FUNC_ERR, __exit, __result); \ + _handle_error_on_obj((__s), SE_RN_WRONG_FUNCTION_REACHED, (__s)->source_file, DON(ast), MB_FUNC_ERR, __exit, __result); \ } while(0) # endif /* _MSC_VER < 1300 */ #endif /* _MSC_VER */ @@ -9030,7 +9030,7 @@ int _skip_struct(mb_interpreter_t* s, _ls_node_t** l, mb_func_t open_func, mb_fu count = 1; do { - if(!ast->next) { + if(!ast || !ast->next) { _handle_error_on_obj(s, SE_RN_STRUCTURE_NOT_COMPLETED, s->source_file, DON(ast), MB_FUNC_ERR, _exit, result); } obj_prev = (_object_t*)ast->data;