Skip to content

Fix NullPointerException in EmpowerPlantActivity cart count update - #268

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

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

Conversation

@cursor

@cursor cursor Bot commented Sep 4, 2026

Copy link
Copy Markdown

This pull request fixes a NullPointerException that occurred when updating the cart badge count in EmpowerPlantActivity. The root cause was that onResume() sets up an RxJava subscription that can emit immediately, but the textCartItemCount TextView is only initialized later in onCreateOptionsMenu() which Android calls after onResume(). The fix adds a null check before calling setText() to safely handle the case where the menu hasn't been inflated 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 in onResume() to prevent
NPE when the subscription fires before onCreateOptionsMenu() inflates the
menu. The Android lifecycle calls onResume() before the options menu is
created, so textCartItemCount may be null on first emission.

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:10
@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 (92443d3).

Files with missing lines Patch % Lines
.../vu/android/empowerplant/EmpowerPlantActivity.java 0.00% 4 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##            main    #268   +/-   ##
=====================================
  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