Skip to content

fix(android): setTextColor is non-nullable, prevent null exception#11147

Merged
NathanWalker merged 2 commits intomainfrom
fix/android-text-color-null-exception
Mar 28, 2026
Merged

fix(android): setTextColor is non-nullable, prevent null exception#11147
NathanWalker merged 2 commits intomainfrom
fix/android-text-color-null-exception

Conversation

@NathanWalker
Copy link
Copy Markdown
Contributor

@NathanWalker NathanWalker commented Mar 27, 2026

  • ensures that setTextColor method is only called with a defined value, preventing crashes based on timing/race

Prevents innocent app crash due to bindings update timing (often on page navigations):

Error: java.lang.NullPointerException
StackTrace:
  [color:setNative](file:///data/data/com.example.app/files/files/app/vendor.mjs)

This occurs because this.nativeTextViewProtected.setTextColor(value) is not nullable.
https://android.googlesource.com/platform/frameworks/base/+/refs/heads/main/core/java/android/widget/TextView.java#5602

@nx-cloud
Copy link
Copy Markdown

nx-cloud bot commented Mar 27, 2026

View your CI Pipeline Execution ↗ for commit 9bc2fbf

Command Status Duration Result
nx test apps-automated -c=android ✅ Succeeded 3m 46s View ↗
nx run-many --target=test --configuration=ci --... ✅ Succeeded <1s View ↗

☁️ Nx Cloud last updated this comment at 2026-03-27 22:24:10 UTC

Copy link
Copy Markdown

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 prevents an Android crash in TextBase by ensuring setTextColor(...) isn’t invoked with a null/undefined value during timing/race conditions in bindings updates.

Changes:

  • Guarded the Android colorProperty.setNative path to avoid calling TextView.setTextColor(...) with an undefined value.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@NathanWalker NathanWalker merged commit e34a8d0 into main Mar 28, 2026
7 checks passed
@NathanWalker NathanWalker deleted the fix/android-text-color-null-exception branch March 28, 2026 03:44
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.

4 participants