firebase-functions icon indicating copy to clipboard operation
firebase-functions copied to clipboard

Fixed issue calling DataSnapshot methods with null data

Open rhodgkins opened this issue 11 months ago • 4 comments

Description

Fixes https://github.com/firebase/firebase-functions-test/pull/254

Fix is similar to the check in #exists():

https://github.com/firebase/firebase-functions/blob/5f7b331abd5a2a38a4e84de1e51411ea5919c0c3/src/common/providers/database.ts#L173

rhodgkins avatar Jan 13 '25 13:01 rhodgkins

@taeold IIUC this is a straight bugfix, but I wanted to double check that you don't consider this a breaking change.

inlined avatar Jan 22 '25 01:01 inlined

Feels like this is a good change and not breaking.

IIUC the change would only break if the traversing the full path instead of short-circuiting somehow had a side effect that was worthy.

taeold avatar Jan 24 '25 22:01 taeold

@taeold any ideas on the timeline when this might be merged / released?

rhodgkins avatar Jan 30 '25 17:01 rhodgkins

Sorry I missed that there were tests in the project for this! I've added some tests for the issue to make it clearer. I've also update the fix as adding tests exposed another issue when this._data is directly null (and not as a result of a child being missing or null).

rhodgkins avatar Feb 05 '25 12:02 rhodgkins

Anyone any update on this please?

rhodgkins avatar Aug 21 '25 10:08 rhodgkins

Thank you for your contribution again @rhodgkins

taeold avatar Oct 08 '25 20:10 taeold