From 91e416b28e2123fa55b04aa91ca9182aeae3f09b Mon Sep 17 00:00:00 2001 From: codeanticode Date: Thu, 24 Oct 2013 10:19:57 -0400 Subject: [PATCH] handle Camera.list() returning null --- .../GettingStartedCapture/GettingStartedCapture.pde | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/java/libraries/video/examples/Capture/GettingStartedCapture/GettingStartedCapture.pde b/java/libraries/video/examples/Capture/GettingStartedCapture/GettingStartedCapture.pde index 33163dc0e..517ba8786 100644 --- a/java/libraries/video/examples/Capture/GettingStartedCapture/GettingStartedCapture.pde +++ b/java/libraries/video/examples/Capture/GettingStartedCapture/GettingStartedCapture.pde @@ -13,11 +13,13 @@ void setup() { String[] cameras = Capture.list(); - if (cameras.length == 0) { + if (cameras == null) { + println("Failed to retrieve the list of available cameras, will try the default..."); + cam = new Capture(this, 640, 480); + } if (cameras.length == 0) { println("There are no cameras available for capture."); exit(); - } - else { + } else { println("Available cameras:"); for (int i = 0; i < cameras.length; i++) { println(cameras[i]);