From 456c56fe907626fe8552d0b46d0c4721e2d723a8 Mon Sep 17 00:00:00 2001 From: Alexander Smorkalov Date: Sat, 13 Apr 2013 19:15:45 +0400 Subject: [PATCH] NullPointerException in case of error on opening native camera fixed. --- .../generator/src/java/android+NativeCameraView.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/modules/java/generator/src/java/android+NativeCameraView.java b/modules/java/generator/src/java/android+NativeCameraView.java index 6f3ab26..62d0775 100644 --- a/modules/java/generator/src/java/android+NativeCameraView.java +++ b/modules/java/generator/src/java/android+NativeCameraView.java @@ -53,14 +53,16 @@ public class NativeCameraView extends CameraBridgeViewBase { /* 1. We need to stop thread which updating the frames * 2. Stop camera and release it */ - try { - mStopThread = true; - mThread.join(); - } catch (InterruptedException e) { - e.printStackTrace(); - } finally { - mThread = null; - mStopThread = false; + if (mThread != null) { + try { + mStopThread = true; + mThread.join(); + } catch (InterruptedException e) { + e.printStackTrace(); + } finally { + mThread = null; + mStopThread = false; + } } /* Now release camera */ -- 2.7.4