Android Question Funny crash in debug mode

grafsoft

Well-Known Member
Licensed User
Longtime User
I get a crash in debug mode, not in release mode - and within a try-catch sequence:

B4X:
Sub Activity_Pause (UserClosed As Boolean)
   Try
     camEx.Release   
     gps1.Stop
   Catch
     Dim s As String
     ' The crash happens here:
     s="Camera pause " & LastException.Message

     Log (s)
     Main.prot.Add (s)
   End Try

LogCat connected to: B4A-Bridge: Lenovo MEDION E4503
Installing file.
--------- beginning of main
Installing file.
PackageAdded: package:photo.Tagger
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (kamera) Create, isFirst = true **
** Activity (kamera) Resume **
** Activity (kamera) Pause, UserClosed = false **
Error occurred on line: 256 (Kamera)
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Exception anywheresoftware.b4a.BA.getLastException()' on a null object reference
at anywheresoftware.b4a.keywords.Common.LastException(Common.java:662)
at Photo.Tagger.kamera._activity_pause(kamera.java:612)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:697)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:336)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:246)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
at anywheresoftware.b4a.ShellBA$2.run(ShellBA.java:115)
at android.os.Handler.handleCallback(Handler.java:810)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:189)
at android.app.ActivityThread.main(ActivityThread.java:5532)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:950)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:745)


What can this be?
 

JordiCP

Expert
Licensed User
Longtime User
Just guessing, can't test it

B4X:
If LastException<>Null then
   s="camera pause "+ LastException.Message
End if
 
Upvote 0

grafsoft

Well-Known Member
Licensed User
Longtime User
Thank you, that was the solution. Funny that the program goes into a catch sequence without error ...
 
Upvote 0
Top