Skip to content

Workaround: don't UPDATE eventStatus to null#85

Merged
rfc2822 merged 5 commits intomainfrom
84-calendar-provider-crashes-with-npe-when-eventstatus-is-updated-to-null-even-when-its-already-null
Sep 24, 2025
Merged

Workaround: don't UPDATE eventStatus to null#85
rfc2822 merged 5 commits intomainfrom
84-calendar-provider-crashes-with-npe-when-eventstatus-is-updated-to-null-even-when-its-already-null

Conversation

@rfc2822
Copy link
Member

@rfc2822 rfc2822 commented Sep 23, 2025

  • Add calendar provider behavior test.
  • Don't update eventStatus to null.

If an eventStatus update is requested, we

1.remove the eventStatus value from the updated values if the value wouldn't change anyway (nullnull), or
2. otherwise delete/re-build the event.

@rfc2822 rfc2822 self-assigned this Sep 23, 2025
@rfc2822 rfc2822 added the bug Something isn't working label Sep 23, 2025
@rfc2822 rfc2822 force-pushed the 84-calendar-provider-crashes-with-npe-when-eventstatus-is-updated-to-null-even-when-its-already-null branch from 57ca597 to 4cc6cac Compare September 23, 2025 12:13
@rfc2822 rfc2822 changed the title Don't UPDATE eventStatus from null to null Workaround: don't UPDATE eventStatus to null Sep 24, 2025
@rfc2822 rfc2822 requested a review from Copilot September 24, 2025 06:11
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements a workaround for an Android Calendar Provider bug where updating an event's status to null causes a NullPointerException. The solution introduces logic to detect when this problematic scenario occurs and either skips the status update or rebuilds the entire event.

Key changes:

  • Refactored event update logic to detect and handle the problematic status update scenarios
  • Added comprehensive test coverage for the workaround behavior
  • Improved existing behavior tests to cover additional edge cases

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
AndroidRecurringCalendar.kt Simplified the update logic by removing the rebuild check and delegating workaround handling to AndroidCalendar
AndroidCalendar.kt Added StatusUpdateWorkaround enum and comprehensive logic to handle the eventStatus=null bug with three strategies
AndroidCalendarTest.kt Added unit tests for the new getStatusUpdateWorkaround method covering all scenarios
AndroidCalendarProviderBehaviorTest.kt Enhanced behavior tests to demonstrate the calendar provider bug and verify workaround effectiveness

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@rfc2822 rfc2822 force-pushed the 84-calendar-provider-crashes-with-npe-when-eventstatus-is-updated-to-null-even-when-its-already-null branch from 298fd0d to 22b3a5c Compare September 24, 2025 06:22
@rfc2822 rfc2822 force-pushed the 84-calendar-provider-crashes-with-npe-when-eventstatus-is-updated-to-null-even-when-its-already-null branch from 22b3a5c to d67b589 Compare September 24, 2025 06:30
@rfc2822 rfc2822 marked this pull request as ready for review September 24, 2025 06:31
Copy link
Member

@sunkup sunkup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Annoying that we need the workaround. Looks good though. They have answered the ticket with a request for more information. apk which shows the bug, video, adb logs ...

@rfc2822 rfc2822 merged commit 095f960 into main Sep 24, 2025
9 checks passed
@rfc2822 rfc2822 deleted the 84-calendar-provider-crashes-with-npe-when-eventstatus-is-updated-to-null-even-when-its-already-null branch September 24, 2025 11:22
@rfc2822
Copy link
Member Author

rfc2822 commented Sep 24, 2025

They have answered the ticket with a request for more information. apk which shows the bug, video, adb logs ...

Yes I have seen it. Will do that tomorrow from the train.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Calendar provider crashes with NPE when eventStatus is UPDATEd to null, even when it's already null

2 participants