Skip to content

app crash when using custom events with offsets #879

@forrestguice

Description

@forrestguice

Describe the bug
The app crashes when configured to display custom events (with before/after offset) whenever the event does not occur. This can be reproduced reliably by configuring the app to polar latitudes that experience midnight sun.

To Reproduce
Steps to reproduce the behavior:

  1. : -> Set Location and configure to an extreme north or south latitude (e.g. +-85 degrees).
  2. : -> Settings -> User Interface -> Manage Events and add a custom event for any negative angle.
  3. Restart the app and verify that the custom event is now displayed and that the card displays typical output for polar day (i.e. event times show none).
  4. : -> Settings -> User Interface -> Mange Events and edit the previously created event.
  5. Click at and add any offset to the event (e.g. 5 minutes before). Save it.
  6. Attempt to restart the app - it now crashes!

Version Info:

  • App Version: 0.16.7

Additional context

2025-06-05 20:23:41.009 2846-2846/com.forrestguice.suntimeswidget E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.forrestguice.suntimeswidget, PID: 2846
    java.lang.NullPointerException: Attempt to invoke virtual method 'void java.util.Calendar.add(int, int)' on a null object reference
        at com.forrestguice.suntimeswidget.calculator.SuntimesRiseSetData.calculate(SuntimesRiseSetData.java:419)
        at com.forrestguice.suntimeswidget.calculator.SuntimesRiseSetDataset.calculateData(SuntimesRiseSetDataset.java:161)
        at com.forrestguice.suntimeswidget.cards.CardAdapter.createData(CardAdapter.java:146)
        at com.forrestguice.suntimeswidget.cards.CardAdapter.initData(CardAdapter.java:121)
        at com.forrestguice.suntimeswidget.cards.CardAdapter.initData(CardAdapter.java:108)
        at com.forrestguice.suntimeswidget.SuntimesActivity.calculateData(SuntimesActivity.java:1876)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions