From 42f7f9a349467221c1798496974964058a6586a3 Mon Sep 17 00:00:00 2001 From: Benjamin Reis Date: Mon, 18 Jun 2018 13:44:19 +0200 Subject: [PATCH] do not crash qrcode tests when qrcode not compiled --- tester/video_tester.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tester/video_tester.c b/tester/video_tester.c index f40781475..b92aba9fd 100644 --- a/tester/video_tester.c +++ b/tester/video_tester.c @@ -89,7 +89,13 @@ typedef struct struct_image_rect { static void _decode_qrcode(const char* image_path, image_rect *rect) { qrcode_callback_data qrcode_data; char *qrcode_image; - LinphoneCoreManager* lcm = linphone_core_manager_create("empty_rc"); + LinphoneCoreManager* lcm = NULL; + MSFactory* factory = NULL; + factory = ms_factory_new_with_voip(); + if (!BC_ASSERT_PTR_NOT_NULL(ms_factory_lookup_filter_by_name(factory, "MSQRCodeReader"))) + goto end; + + lcm =linphone_core_manager_create("empty_rc"); LinphoneCoreCbs* cbs = NULL; qrcode_data.qrcode_found = FALSE; qrcode_data.text = NULL; @@ -122,6 +128,8 @@ static void _decode_qrcode(const char* image_path, image_rect *rect) { linphone_core_enable_video_preview(lcm->lc, FALSE); linphone_core_manager_destroy(lcm); +end: + ms_factory_destroy(factory); } static void decode_qrcode_from_image(void) {