Skip to content

Prevent crashes if OSMDroidMapFragment is destroyed before view is created#7108

Merged
grzesiek2010 merged 1 commit intogetodk:v2026.1.xfrom
seadowg:osm-crash
Feb 20, 2026
Merged

Prevent crashes if OSMDroidMapFragment is destroyed before view is created#7108
grzesiek2010 merged 1 commit intogetodk:v2026.1.xfrom
seadowg:osm-crash

Conversation

@seadowg
Copy link
Member

@seadowg seadowg commented Feb 20, 2026

Closes #7051

Why is this the best possible solution? Were any other approaches considered?

This was a pretty simple fix once I'd worked out the problem: the OSM map implementation would hit a NullPointerException when being destroyed due to an Activity being finished early in this scenario because the view might not have been created yet.

How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?

Just a very small change to just OSM, so nothing else needs looked at.

Before submitting this PR, please make sure you have:

  • added or modified tests for any new or changed behavior
  • run ./gradlew connectedAndroidTest (or ./gradlew testLab) and confirmed all checks still pass
  • added a comment above any new strings describing it for translators
  • added any new strings with date formatting to DateFormatsTest
  • verified that any code or assets from external sources are properly credited in comments and/or in the about file.
  • verified that any new UI elements use theme colors. UI Components Style guidelines

@seadowg seadowg changed the base branch from master to v2026.1.x February 20, 2026 13:37
@seadowg seadowg added the high priority Should be looked at before other PRs/issues label Feb 20, 2026
@seadowg seadowg marked this pull request as ready for review February 20, 2026 14:18
@seadowg seadowg requested a review from grzesiek2010 February 20, 2026 14:18
@grzesiek2010 grzesiek2010 merged commit 665e3be into getodk:v2026.1.x Feb 20, 2026
8 checks passed
@dbemke
Copy link

dbemke commented Feb 23, 2026

The apk isn't available in https://github.com/getodk/collect/commits/v2026.1.x

@seadowg
Copy link
Member Author

seadowg commented Feb 23, 2026

@dbemke building now!

@WKobus
Copy link

WKobus commented Feb 23, 2026

Tested with success

Verified on device with Android 16

Verified cases:

@seadowg seadowg deleted the osm-crash branch February 23, 2026 13:04
@dbemke
Copy link

dbemke commented Feb 23, 2026

Tested with success

Verified on device with Android 10

seadowg pushed a commit to seadowg/collect that referenced this pull request Mar 4, 2026
Prevent crashes if OSMDroidMapFragment is destroyed before view is created
@seadowg seadowg mentioned this pull request Mar 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

behavior verified high priority Should be looked at before other PRs/issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants