Android Question Attempt to invoke virtual method 'void anywheresoftware.b4a.objects.collections.List.Initialize()' on a null object refere

Filippo

Expert
Licensed User
Longtime User
Hi,

I have this error message in Firebase Crashlytics caused by Galaxy S23 Ultra ( Android 14).

The error only occurs since Android 14.

Has anyone had the same error?
If so, how can it be solved?

In a "jobdone" sub I have this code:
B4X:
Sub JobDone(job As HttpJob)
    Dim parser As JSONParser
    Dim res As String
    
    If job.Success Then
        res = job.GetString
        parser.Initialize(res)
        'Log(job.GetString)
        Select job.JobName
            Case "RequestProductsInformation"
                Dim list As List
                lst.Initialize
                Try
                    list = parser.NextArray
                Catch
                    ToastMessageShow("Error when checking the license!", True)
                    Return
                End Try
                If list.Size > 0 Then
                    Dim mp As Map = list.Get(0)
                    CallSub2(CallBack, mEventName & "_ShowInAppBilling", mp)
                Else
                    ToastMessageShow("Kein App-Produkt in der Datenbank vorhanden!", True)
                End If
        End Select
    End If
    job.Release
End Sub

Firebase-Crashlytics:
Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'void anywheresoftware.b4a.objects.collections.List.Initialize()' on a null object reference
at fg.cronomillemiglia.clsinappbilling._jobdone(clsinappbilling.java:1639)
at java.lang.reflect.Method.invoke(Method.java)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:221)
at anywheresoftware.b4a.keywords.Common$12.run(Common.java:1212)
at android.os.Handler.handleCallback(Handler.java:958)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:230)
at android.os.Looper.loop(Looper.java:319)
at android.app.ActivityThread.main(ActivityThread.java:8893)

clsinappbilling.java:

1708072650813.png
 

Daestrum

Expert
Licensed User
Longtime User
You're missing an 'i'
B4X:
                Dim list As List
                lst.Initialize    '<<<  lst instead of list
                Try
                    list = parser.NextArray
                Catch
 
Upvote 2
Solution
Top