Skip to content

Ignore null extension values when merging messages - #1112

Open
apwilson wants to merge 1 commit into
google:masterfrom
apwilson:fix-null-extension-merge
Open

apwilson wants to merge 1 commit into
google:masterfrom
apwilson:fix-null-extension-merge

Conversation

@apwilson

@apwilson apwilson commented Nov 4, 2026

Copy link
Copy Markdown

FieldSet._mergeFromMessage skipped null entries for regular fields, and ExtensionFieldSet already guarded against null values in _hasField, _shallowCopyValues, _markReadOnly, and _deepCopy, but _mergeFromMessage passed extension values from _getFieldOrNull straight into _mergeField without a null check. Because _mergeField only returned early on null for map fields, merging a message with a null extension slot threw a null cast or validation error on message, repeated, and scalar extensions instead of leaving destination values intact.

`FieldSet._mergeFromMessage` skipped `null` entries for regular fields, and
`ExtensionFieldSet` already guarded against `null` values in `_hasField`,
`_shallowCopyValues`, `_markReadOnly`, and `_deepCopy`, but `_mergeFromMessage`
passed extension values from `_getFieldOrNull` straight into `_mergeField`
without a null check. Because `_mergeField` only returned early on `null` for
map fields, merging a message with a `null` extension slot threw a null cast or
validation error on message, repeated, and scalar extensions instead of leaving
destination values intact.
@apwilson
apwilson force-pushed the fix-null-extension-merge branch from 9ee9b3c to bbcd095 Compare November 11, 2026 16:38
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