Fix NULL check 89/305089/1
authorKwanghoon Son <k.son@samsung.com>
Fri, 26 Jan 2024 09:26:54 +0000 (18:26 +0900)
committerKwanghoon Son <k.son@samsung.com>
Fri, 26 Jan 2024 09:30:04 +0000 (18:30 +0900)
Detect callback message could be null.

WID:62132701 After having been assigned to a NULL value at
mv_barcode_detect_open.cpp:240, pointer '0' is passed as 4th parameter
in call to function 'barcode_detected_cb' at
mv_barcode_detect_open.cpp:240, where it is dereferenced at
test_barcode.cpp:25.

Change-Id: I1f0938300bd39caaadd998ebac9ebc2b5ab39a04
Signed-off-by: Kwanghoon Son <k.son@samsung.com>
test/testsuites/barcode/test_barcode.cpp

index 3b606b2..d0bc01e 100644 (file)
@@ -21,8 +21,9 @@ void barcode_detected_cb(mv_source_h source, mv_engine_config_h engine_cfg, cons
                                                 const char *messages[], const mv_barcode_type_e *types, int number_of_barcodes,
                                                 void *user_data)
 {
-       EXPECT_EQ(number_of_barcodes, 1);
-       EXPECT_STREQ(messages[0], (const char *) user_data);
+       ASSERT_EQ(number_of_barcodes, 1);
+       if (messages)
+               EXPECT_STREQ(messages[0], (const char *) user_data);
 }
 
 vector<TestParams> ReadDetPositive1()