[PATCH 5/7] android/haltest: Improve EXEC macro robustness

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 a83f48b..4a5d4cc 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 */
-- 
1.8.5.2

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux