Skip to content

Conversation

@Akash05-kr
Copy link

@Akash05-kr Akash05-kr commented Nov 24, 2025

I'm Akash kumar , a contributor working on the OneBusAway. This pull request fixes #1278 by adding null-safety checks to prevent NullPointerException errors when handling null format arguments in string resources.

Changes Made:

Null Argument Handling: Added safeGetString() utility method in UIUtils.java that replaces any null elements in format arguments with empty strings before calling Context.getString(). This prevents formatting errors and unwanted "null" text from appearing in UI strings.

Implementation: The method iterates through the varargs array and converts null values to empty strings, ensuring the string resource formatter always receives valid arguments.

I tested this by simulating null format arguments in various string resource calls throughout the codebase, and it successfully prevents crashes while maintaining clean UI text display.

  • Apply the AndroidStyle.xml style template to your code in Android Studio.

  • Run the unit tests with gradlew connectedObaGoogleDebugAndroidTest to make sure you didn't break anything

  • If you have multiple commits please combine them into one commit by squashing them for the initial submission of the pull request. When addressing comments on a pull request, please push a new commit per comment when possible (reviewers will squash and merge using GitHub merge tool)

@Akash05-kr Akash05-kr changed the title fix: resolve nullPointerException issue#1278 fix: resolve nullPointerException issue Nov 24, 2025
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.

[Crash] - NullPointerException in UIUtils.getAllSituations

1 participant