Android Question Runtime error

davemorris

Active Member
Licensed User
Longtime User
Hi Guys

I am having a strange problem with some test code. When I use class my clsPlayerInfoRec and run clsPlayerInfoRec.Initailize I get a runtime error.
I have to say it is used is other parts of the test program and in the actual App without problems.

I have attached a copy of the class clsPlayerInfoRec

Line of code creating the run time error is (but it has to be said the same line of code appears in subs throughout the code)

Run time error caused by this line:
 Dim newPlayerInfo As clsPlayerInfoRec : newPlayerInfo.initialize
and


A typical statement invoking and using this class in a sub is
Typical snippet of code to invoke and use the class:
    Dim newPlayerInfo As clsPlayerInfoRec : newPlayerInfo.initialize
    newPlayerInfo.name = name
    newPlayerInfo.nameCompressed = nameCompressed
    newPlayerInfo.started = started
    newPlayerInfo.startTime = startTime

This the error report
---------------------------------
Error occurred on line: 60 (clsPlayerInfoRec)
java.lang.NullPointerException: Attempt to read from field 'anywheresoftware.b4a.BALayout anywheresoftware.b4a.BA.vg' on a null object reference
at anywheresoftware.b4a.BA.<init>(BA.java:109)
at anywheresoftware.b4a.ShellBA.<init>(ShellBA.java:56)
at b4a.Ui_Tests.clsplayerinforec.innerInitialize(clsplayerinforec.java:13)
at b4a.Ui_Tests.clsplayerinforec._initialize(clsplayerinforec.java:180)
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:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:157)
at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:1114)
at anywheresoftware.b4a.keywords.Common.CallSubNew(Common.java:1061)
at b4a.Ui_Tests.ctestrunner$ResumableSub_PerformTestsResumable.resume(ctestrunner.java:234)
at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resumeAsUserSub(DebugResumableSub.java:48)
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:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:157)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:201)
at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resume(DebugResumableSub.java:43)
at anywheresoftware.b4a.keywords.Common$14.run(Common.java:1748)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:211)
at android.app.ActivityThread.main(ActivityThread.java:5389)
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:1020)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:815)

-------------------------------------------------

Has anyone got some ideas

Dave Morris
 

Attachments

  • clsPlayerInfoRec.bas
    7.2 KB · Views: 52

davemorris

Active Member
Licensed User
Longtime User
HI Erel

You are correct it was initialisation related. But it was higher up in the call chain, i.e. it was the class which called the class that throw the error that was not initialised - (Easily find be comparing it to usage that did work.)

Thanks for the help (I have marked your post as the solution)
Dave
 
Upvote 0
Top