From 7ae5a0c3330b91d9d4eec32252a750fcb71e36a4 Mon Sep 17 00:00:00 2001 From: Julien Ehrhart Date: Sun, 2 Aug 2015 16:16:19 +0000 Subject: [PATCH] Fix nfc-poll card removing check (should be done only if a target has been found). --- examples/nfc-poll.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/examples/nfc-poll.c b/examples/nfc-poll.c index a42c41a..fde8ea8 100644 --- a/examples/nfc-poll.c +++ b/examples/nfc-poll.c @@ -145,15 +145,14 @@ main(int argc, const char *argv[]) if (res > 0) { print_nfc_target(&nt, verbose); + printf("Waiting for card removing..."); + while (0 == nfc_initiator_target_is_present(pnd, NULL)) {} + nfc_perror(pnd, "nfc_initiator_target_is_present"); + printf("done.\n"); } else { printf("No target found.\n"); } - printf("Waiting for card removing..."); - while (0 == nfc_initiator_target_is_present(pnd, NULL)) {} - nfc_perror(pnd, "nfc_initiator_target_is_present"); - printf("done.\n"); - nfc_close(pnd); nfc_exit(context); exit(EXIT_SUCCESS);