Skip to content

Commit 80a4b28

Browse files
author
Kyrylo
committed
Do not print generic document if it's null
1 parent ffb3943 commit 80a4b28

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

examples/c/src/snippets/datacapture/credit_card_scanner.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ scanbotsdk_error_code_t print_credit_card_result(scanbotsdk_credit_card_scanning
1818
const char *detection_status_str = NULL;
1919
scanbotsdk_document_detection_status_t_to_string(detection_status, &detection_status_str);
2020
printf("Document Detection status: %s\n", detection_status_str);
21-
if (credit_card != NULL) {
22-
ec = print_generic_document_fields(credit_card);
23-
}
21+
ec = print_generic_document_fields(credit_card);
2422
return ec;
2523
}
2624

examples/c/src/utils/utils.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ scanbotsdk_error_code_t load_image_from_path(const char *path, scanbotsdk_image_
1313
}
1414

1515
scanbotsdk_error_code_t print_generic_document_fields(scanbotsdk_generic_document_t *doc) {
16+
if (doc == NULL) {
17+
printf("No document data available.\n");
18+
return SCANBOTSDK_OK;
19+
}
1620
size_t fields_count = 0;
1721
scanbotsdk_field_t **fields = NULL;
1822
scanbotsdk_error_code_t ec = scanbotsdk_generic_document_get_fields_size(doc, &fields_count);

0 commit comments

Comments
 (0)