Skip to content

Fix NullPointerException in EmpowerPlantActivity cart badge - #269

Open
cursor[bot] wants to merge 1 commit into
mainfrom
seer/nullpointerexception-attempt-to-jm601h
Open

Fix NullPointerException in EmpowerPlantActivity cart badge#269
cursor[bot] wants to merge 1 commit into
mainfrom
seer/nullpointerexception-attempt-to-jm601h

Conversation

@cursor

@cursor cursor Bot commented Sep 4, 2026

Copy link
Copy Markdown

This pull request fixes a NullPointerException that occurs when launching EmpowerPlantActivity. The issue was caused by an Android lifecycle ordering problem: onResume() sets up an RxJava subscription to update the cart badge count, but the subscription can emit before onCreateOptionsMenu() has inflated the options menu and initialized the textCartItemCount view. The fix adds a null check before updating the badge, preventing the crash when the view hasn't been created yet.

This pull request was triggered by a Seer handoff from Sentry.

Fixes ANDROID-MN

Open in Web Open in Cursor 

Add null check before updating textCartItemCount to prevent NPE when
onResume() fires before onCreateOptionsMenu() inflates the options menu.
The RxJava subscription can emit before the menu is created, causing a
crash when trying to update the null textCartItemCount view.

Fixes [ANDROID-MN](https://demo.sentry.io/issues/7694740115/)
@cursor
cursor Bot requested a review from sdzhong as a code owner September 4, 2026 10:11
@sentry

sentry Bot commented Sep 4, 2026

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
Android com.example.vu.android 24.12.26 (241226) release
Android com.example.vu.android 24.12.26 (241226) debug
Android com.example.vu.android 24.12.26 (241226) release

⚙️ android Build Distribution Settings

@codecov

codecov Bot commented Sep 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 0.00%. Comparing base (21c77a4) to head (beeb3f8).

Files with missing lines Patch % Lines
.../vu/android/empowerplant/EmpowerPlantActivity.java 0.00% 4 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##            main    #269   +/-   ##
=====================================
  Coverage   0.00%   0.00%           
=====================================
  Files         16      16           
  Lines        883     885    +2     
  Branches      67      67           
=====================================
- Misses       883     885    +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant