Android Question Debug Issue

bocker77

Active Member
Licensed User
Longtime User
I am getting the following error during a simple IF statement. This appears to have happened after installing a game on my PC. The game in question upgraded the Visual C++ run time environment which should not be causing my problem. I have no idea if it was the install of the game but that is the only thing that changed and that I can think of. Also I have rebooted my PC to clear memory but I still get this error. It also errors out in Release.

Java Version: 11 seen during compile.

Error occurred on line: 1130 (B4XMainPage)
java.lang.NullPointerException
at anywheresoftware.b4a.debug.RDebugUtils.equals(RDebugUtils.java:46)
at anywheresoftware.b4a.debug.RDebugUtils.solveBoolean(RDebugUtils.java:122)Also
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:348)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:157)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:201)
at anywheresoftware.b4a.shell.DebugResumableSub$RemoteResumableSub.resume(DebugResumableSub.java:22)
at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:275)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:150)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:201)
at anywheresoftware.b4a.keywords.Common$15.run(Common.java:1804)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:250)
at android.app.ActivityThread.main(ActivityThread.java:7803)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:958)

Line 1130 is the IF statement
B4X:
    If 13 < 11 Then
        ' Determine if the Power's capital has been captured
        bCapitalCaptured = Int2Bool(sqlDB.ExecQuerySingleResult("SELECT captured FROM Powers " & _
                                                            "WHERE Power = " & Territory.OrigPWR))        
    End If
 

bocker77

Active Member
Licensed User
Longtime User
No its an INTEGER.

CREATE TABLE "Powers" (
"power" INTEGER,
"ipcs" INTEGER,
"captured" INTEGER,
"warbonds" INTEGER,
"impnsy" INTEGER
);
 
Upvote 0

bocker77

Active Member
Licensed User
Longtime User
Here is the sub that turns the int into a boolean.

B4X:
Sub Int2Bool(value As Int) As Boolean
    If value = 0 Then Return False
    Return True
End Sub
 
Upvote 0

Daestrum

Expert
Licensed User
Longtime User
Are you certain that the select is actually returning something? Don't assume a select will return anything, always check.
 
Upvote 0

bocker77

Active Member
Licensed User
Longtime User
I found the problem. It was the next If statement. While debugging I am not sure why the app kept erroring at the previous If statement without giving me any indication why. Also no source number in my code being given. Then it would have been easy to debug.

Anyway thanks to all for your help.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…