[aravis] arvshowdevices: extra check for returned device id before sending it to printf.



commit 435e219fce1692ffe29ae7fe32a014d4b261ca03
Author: Emmanuel Pacaud <emmanuel pacaud lapp in2p3 fr>
Date:   Mon Sep 27 14:41:59 2010 +0200

    arvshowdevices: extra check for returned device id before sending it to printf.

 src/arvshowdevices.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/src/arvshowdevices.c b/src/arvshowdevices.c
index c5ffff7..5c75a69 100644
--- a/src/arvshowdevices.c
+++ b/src/arvshowdevices.c
@@ -16,8 +16,13 @@ main (int argc, char **argv)
 	else {
 		unsigned int i;
 
-		for (i = 0; i < n_devices; i++)
-			printf ("%s\n", (char *) arv_get_device_id (i));
+		for (i = 0; i < n_devices; i++) {
+			const char *device_id;
+
+			device_id = arv_get_device_id (i);
+			if (device_id != NULL)
+				printf ("%s\n",  device_id);
+		}
 	}
 
 	return EXIT_SUCCESS;



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