Skip to content

App crashes in ChangeLogFragment due to Uninitialized RecyclerView #4

@euptron

Description

@euptron

Problem Description

The app encounters a NullPointerException in the ChangeLogFragment class when attempting to read from a RecyclerView that has not been initialized. This issue occurs because the RecyclerView reference is null when checkIfLoaded() is called. As a result, the app crashes when handling data load events.

Steps to Reproduce the Behavior

  1. Open the app and navigate to the section where ChangeLogFragment is used.
  2. Trigger a data load event (e.g., by initiating a network request for logs).
  3. Observe the crash, which occurs when the app tries to read from a null RecyclerView reference in the checkIfLoaded() method.

Expected Behavior

  • The app should handle data load events in ChangeLogFragment without crashing. The RecyclerView should be properly initialized before accessing its properties, ensuring smooth data handling.

Crash Details

  • Crash Date: Tue AGMT+0100 (West Africaug 20 2024 04:23:04 GMT+0100 (West Africa Standard Time)
Crashlytics Issue ID

4dfd5aed0ff4905420e59f5b3b09ce90

  • Thread: main
  • Exception: java.lang.NullPointerException
    Message:
    Non-fatal Exception: java.lang.NullPointerException: Attempt to read from field 'androidx.recyclerview.widget.RecyclerView J0.i.f' on a null object reference
    

Why Error Occurred: The app crashes because the RecyclerView reference in ChangeLogFragment is null when checkIfLoaded() attempts to access it.

Stack Trace

Non-fatal Exception: java.lang.NullPointerException: Attempt to read from field 'androidx.recyclerview.widget.RecyclerView J0.i.f' on a null object reference
       at com.eup.codeopsstudio.ui.settings.ChangeLogFragment.checkIfLoaded(ChangeLogFragment.java:163)
       at com.eup.codeopsstudio.ui.settings.ChangeLogFragment$1.onDataLoaded(ChangeLogFragment.java:98)
       at com.eup.codeopsstudio.ui.settings.ChangeLogFragment.lambda$fetchLogs$1(ChangeLogFragment.java:200)
       at com.android.volley.toolbox.JsonRequest.deliverResponse(JsonRequest.java:100)
       at com.android.volley.ExecutorDelivery$ResponseDeliveryRunnable.run(ExecutorDelivery.java:102)
       at android.os.Handler.handleCallback(Handler.java:900)
       at android.os.Handler.dispatchMessage(Handler.java:103)
       at android.os.Looper.loop(Looper.java:219)
       at android.app.ActivityThread.main(ActivityThread.java:8403)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1087)

System Information

  • Package Name: com.eup.codeopsstudio
  • App Version: 1.0.0 (1)

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions