From 475e1c3639b5a06a112e74b3ba0eff457166cf2b Mon Sep 17 00:00:00 2001 From: Szymon Janc Date: Mon, 30 Dec 2013 23:43:39 +0100 Subject: [PATCH] android/haltest: Improve EXEC macro robustness Print info about method being NULL instead of crashing. --- android/client/if-main.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/android/client/if-main.h b/android/client/if-main.h index a83f48be3..4a5d4ccc5 100644 --- a/android/client/if-main.h +++ b/android/client/if-main.h @@ -147,8 +147,12 @@ const struct method *get_interface_method(const char *iname, /* Helper macro for executing function on interface and printing BT_STATUS */ #define EXEC(f, ...) \ { \ - int err = f(__VA_ARGS__); \ - haltest_info("%s: %s\n", #f, bt_status_t2str(err)); \ + if (f) { \ + int err = f(__VA_ARGS__); \ + haltest_info("%s: %s\n", #f, bt_status_t2str(err)); \ + } else { \ + haltest_info("%s is NULL\n", #f); \ + } \ } /* Helper macro for executing void function on interface */ -- 2.47.3