Fix crash on Category rows with NULL/degenerate localized_name - #695
Merged
Conversation
Room's non-null field read path throws IllegalStateException on a genuine SQL NULL before any type converter runs, so the fix is a data-repair migration (v7->v8) plus a defensive converter fallback for the related non-null-but-degenerate case a legacy migration bug can produce. Closes #694
troymyree-lang
requested review from
Michael Gonzalez (MicGon7) and
dlucci-wt
as code owners
August 28, 2026 16:46
…hema-enforced one Room's 6->7 auto-migration does a full table rebuild that enforces NOT NULL, so a genuine SQL NULL can never actually survive today's migration path -- confirmed by CI rejecting the original test's insert with a SQLiteConstraintException. Rewrote the MIGRATION_7_8 test to seed a physically-drifted table directly instead of through Room's schema-enforced helper. Also fixes a collateral break in the pre-existing migrate5to6 test caused by the DB version bump.
Closed
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
MIGRATION_7_8to repair legacyCategoryrows whoselocalized_nameis a genuine SQLNULL(fromMIGRATION_3_4's "My Sayings" insert) — Room's generated read path for a non-null field throwsIllegalStateExceptionbefore any type converter runs, so this has to be fixed at the data layer, not the converter.Converters.languagesWithTextToStringMapNonNullas a defensive fallback for the related but distinct case of a non-null-but-degenerate value (the literal string"null", produced by a Kotlin string-interpolation bug inMIGRATION_5_6).Ticket
Closes #694
Type of Change
Testing
MigrationTest.migrate7to8_repairsNullLocalizedName,RoomStoredCategoriesRepositoryTest)./gradlew :app:compileDebugAndroidTestKotlin) and will run via this repo's Firebase Test Lab CIChecklist
./gradlew testDebug)Documentation/work-log/694-fix-null-category-name-crash.mdfor full investigation notes