Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when location is set #623

Closed
s1shed opened this issue Sep 20, 2022 · 5 comments · Fixed by #627
Closed

Crash when location is set #623

s1shed opened this issue Sep 20, 2022 · 5 comments · Fixed by #627
Labels
Milestone

Comments

@s1shed
Copy link

s1shed commented Sep 20, 2022

Describe the bug
The app crashes when my location is set, either manually or using GPS.

To Reproduce
Steps to reproduce the behavior:

  1. Tap the Location icon
  2. Change the mode to "Current (Last known)"
  3. Tap the crosshair button
  4. See error

Version Info:

  • App Version: 0.14.5, 0.14.6, 0.14.7 (all that I currently see in the F-Droid repositories)
  • Android Version: 13 (also crashes with Android 10 on another device)
  • Device Model: Pixel 6 (also crashes on a Huawei P20 Pro)

Additional context
I will also see the crash if I define the location manually, without using GPS.

kuva

If I keep the location to the default (which is several hundred miles kilometers away) the app doesn't crash.

@forrestguice
Copy link
Owner

Hi. Thanks for reporting this.

Unfortunately I'm unable to reproduce it on any of my devices (newest running Android 10), or when running the emulator. I think there must be some other condition that I'm not testing (one occurs reliably on your devices). I doubt the bug is device specific, or even Android version specific. It might be something locale specific but I'm just guessing. A lot more detail is needed to debug it this way.

The good news is there is an Exception in your device's logcat; an error message and stack trace printed every time the app crashes. If you are able to access that log and copy that error here, it should be easy to fix.

@s1shed
Copy link
Author

s1shed commented Sep 21, 2022

For whatever reason Suntimes is opening for me now, but if I go back to yesterday it crashes. This happens on both of my devices.

I'll see about getting the entries from logcat. Hopefully the crash will still be reproducible going back to, e.g., September 20th.

@s1shed
Copy link
Author

s1shed commented Sep 21, 2022

Hopefully this will help…

The app opens and I can go forward a few days. Going back to yesterday yields a crash. The logcat entry is below:

09-21 23:58:26.827  9835  9835 I QarthLog: [PatchStore] createDisableExceptionQarthFile
09-21 23:58:26.827  9835  9835 I QarthLog: [PatchStore] create disable file for com.forrestguice.suntimeswidget uid is 10488
09-21 23:58:26.833  9835  9835 E AndroidRuntime: FATAL EXCEPTION: main
09-21 23:58:26.833  9835  9835 E AndroidRuntime: Process: com.forrestguice.suntimeswidget, PID: 9835
09-21 23:58:26.833  9835  9835 E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke virtual method 'long java.util.Calendar.getTimeInMillis()' on a null object reference
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at com.forrestguice.suntimeswidget.MoonPhaseView.updateIllumination(MoonPhaseView.java:285)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at com.forrestguice.suntimeswidget.MoonPhaseView.updateViews(MoonPhaseView.java:247)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at com.forrestguice.suntimeswidget.cards.CardViewHolder.bindDataToPosition(CardViewHolder.java:290)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at com.forrestguice.suntimeswidget.cards.CardAdapter.onBindViewHolder(CardAdapter.java:206)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at com.forrestguice.suntimeswidget.cards.CardAdapter.onBindViewHolder(CardAdapter.java:56)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.support.v7.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:6354)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.support.v7.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:6387)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.support.v7.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline(RecyclerView.java:5343)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5606)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5448)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5444)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2224)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1551)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1511)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.support.v7.widget.LinearLayoutManager.scrollBy(LinearLayoutManager.java:1325)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.support.v7.widget.LinearLayoutManager.scrollHorizontallyBy(LinearLayoutManager.java:1049)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.support.v7.widget.RecyclerView.scrollByInternal(RecyclerView.java:1702)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.support.v7.widget.RecyclerView.onTouchEvent(RecyclerView.java:2894)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.view.View.dispatchTouchEvent(View.java:13699)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3243)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2924)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3249)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2938)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3249)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2938)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3249)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2938)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3249)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2938)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3249)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2938)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3249)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2938)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3249)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2938)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3249)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2938)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:741)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:2013)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.app.Activity.dispatchTouchEvent(Activity.java:4180)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:71)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:71)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:687)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.view.View.dispatchPointerEvent(View.java:13962)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:6420)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:6215)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5604)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5657)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5623)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:5781)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5631)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:5838)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5604)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5657)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5623)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5631)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5604)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:8701)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:8621)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:8574)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:8959)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:239)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(Native Method)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:222)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:8862)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:9033)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1280)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.view.Choreographer.doCallbacks(Choreographer.java:1019)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.view.Choreographer.doFrame(Choreographer.java:904)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1248)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.os.Handler.handleCallback(Handler.java:900)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:103)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:219)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:8668)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
09-21 23:58:26.833  9835  9835 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1109)
09-21 23:58:26.591  1703  1887 I chatty  : uid=1000(system) PowerManagerSer identical 2 lines
09-21 23:58:26.757  1703  1887 I PowerManagerService: handleSandman: wakefulness: 1,startDreaming: false
09-21 23:58:26.838  1703  9903 I DropBoxManagerService: add tag=data_app_crash isTagEnabled=true flags=0x2
09-21 23:58:26.838  1703  1969 W ActivityTaskManager:   finishTopCrashedActivityLocked Force finishing activity com.forrestguice.suntimeswidget/.SuntimesActivity
09-21 23:58:26.839  1703  1969 V ActivityTaskManager: positionChild stackId=0 to top.

@s1shed
Copy link
Author

s1shed commented Sep 21, 2022

Going 9 days ahead it crashes with the same sort of stacktrace.

09-22 00:09:12.927 16060 16060 I QarthLog: [PatchStore] createDisableExceptionQarthFile
09-22 00:09:12.927 16060 16060 I QarthLog: [PatchStore] create disable file for com.forrestguice.suntimeswidget uid is 10488
09-22 00:09:12.930 16060 16060 E AndroidRuntime: FATAL EXCEPTION: main
09-22 00:09:12.930 16060 16060 E AndroidRuntime: Process: com.forrestguice.suntimeswidget, PID: 16060
09-22 00:09:12.930 16060 16060 E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke virtual method 'long java.util.Calendar.getTimeInMillis()' on a null object reference
09-22 00:09:12.930 16060 16060 E AndroidRuntime:        at com.forrestguice.suntimeswidget.MoonPhaseView.updateIllumination(MoonPhaseView.java:285)
09-22 00:09:12.930 16060 16060 E AndroidRuntime:        at com.forrestguice.suntimeswidget.MoonPhaseView.updateViews(MoonPhaseView.java:247)
09-22 00:09:12.930 16060 16060 E AndroidRuntime:        at com.forrestguice.suntimeswidget.cards.CardViewHolder.bindDataToPosition(CardViewHolder.java:290)
09-22 00:09:12.930 16060 16060 E AndroidRuntime:        at com.forrestguice.suntimeswidget.cards.CardAdapter.onBindViewHolder(CardAdapter.java:206)
09-22 00:09:12.930 16060 16060 E AndroidRuntime:        at com.forrestguice.suntimeswidget.cards.CardAdapter.onBindViewHolder(CardAdapter.java:56)
09-22 00:09:12.930 16060 16060 E AndroidRuntime:        at android.support.v7.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:6354)
09-22 00:09:12.930 16060 16060 E AndroidRuntime:        at android.support.v7.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:6387)
09-22 00:09:12.930 16060 16060 E AndroidRuntime:        at android.support.v7.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline(RecyclerView.java:5343)
09-22 00:09:12.930 16060 16060 E AndroidRuntime:        at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5606)
09-22 00:09:12.930 16060 16060 E AndroidRuntime:        at android.support.v7.widget.GapWorker.prefetchPositionWithDeadline(GapWorker.java:285)
09-22 00:09:12.930 16060 16060 E AndroidRuntime:        at android.support.v7.widget.GapWorker.flushTaskWithDeadline(GapWorker.java:342)
09-22 00:09:12.930 16060 16060 E AndroidRuntime:        at android.support.v7.widget.GapWorker.flushTasksWithDeadline(GapWorker.java:358)
09-22 00:09:12.930 16060 16060 E AndroidRuntime:        at android.support.v7.widget.GapWorker.prefetch(GapWorker.java:365)
09-22 00:09:12.930 16060 16060 E AndroidRuntime:        at android.support.v7.widget.GapWorker.run(GapWorker.java:396)
09-22 00:09:12.930 16060 16060 E AndroidRuntime:        at android.os.Handler.handleCallback(Handler.java:900)
09-22 00:09:12.930 16060 16060 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:103)
09-22 00:09:12.930 16060 16060 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:219)
09-22 00:09:12.930 16060 16060 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:8668)
09-22 00:09:12.930 16060 16060 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
09-22 00:09:12.930 16060 16060 E AndroidRuntime:        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
09-22 00:09:12.930 16060 16060 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1109)
09-22 00:09:12.935  1703 16154 I DropBoxManagerService: add tag=data_app_crash isTagEnabled=true flags=0x2
09-22 00:09:12.935  1703  1969 W ActivityTaskManager:   finishTopCrashedActivityLocked Force finishing activity com.forrestguice.suntimeswidget/.SuntimesActivity
09-22 00:09:12.936  1703  1969 V ActivityTaskManager: positionChild stackId=0 to top.
09-22 00:09:12.938  1703 16153 I QarthDisFileCreator: pattern not match

forrestguice added a commit that referenced this issue Sep 22, 2022
Fixes app crash (NPE) at higher latitudes when displaying moon illumination. #623

It shouldn't be assumed that all locations experience moonrise/moonset on a given day. The lunar noon (and lunar midnight) calendars are possibly null and must be checked first.

If lunar noon doesn't occur, display illumination at solar noon instead.
@forrestguice
Copy link
Owner

forrestguice commented Sep 22, 2022

That was very helpful. Thank you.
I'm pretty sure I understand what is happening now. It should be fixed in v0.14.8.

I'm able to reproduce it by updating the location to a high latitude. The crash happens afterward when updating the UI. The app tries to display the moon's illumination at lunar noon, but assuming moonrise/moonset occurs everywhere on a given day is a mistake. That assumption was the cause of the crash, and looking closely at the 'world map' dialog it seems obvious in hindsight.

I'm feeling fortunate this bug was reported. Thank you again. Its likely it would have remained unnoticed for a long time.

@forrestguice forrestguice added this to the v0.14.8 milestone Sep 22, 2022
This was referenced Sep 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants