NullPointerException in case of error on opening native camera fixed.
authorAlexander Smorkalov <alexander.smorkalov@itseez.com>
Sat, 13 Apr 2013 15:15:45 +0000 (19:15 +0400)
committerAlexander Smorkalov <alexander.smorkalov@itseez.com>
Mon, 29 Apr 2013 07:00:52 +0000 (11:00 +0400)
modules/java/generator/src/java/android+NativeCameraView.java

index 6f3ab26..62d0775 100644 (file)
@@ -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 */