Skip to content
Snippets Groups Projects
Verified Commit f89c4387 authored by aguestuser's avatar aguestuser
Browse files

[hf] safely destructure identity failure errors

* BUG SYMPTOM: some send response handlers error when they try to
  destructure a null `data` field
* CAUSE: the `{identityFailure}` destructuring assignment unsafely
  assumes that all `send_message` values will have a `data` field on
  which we can call `data[0]`
* FIX: don't assume anything about the shape of the `data`
  field. extract `identityFailure` from it (if it is there) with a
  lodash `get` call to the full path to the field we are trying
  to (conditionally) extract
parent ffc62faa
Branches
Tags
No related merge requests found
...@@ -102,8 +102,7 @@ const handle = message => { ...@@ -102,8 +102,7 @@ const handle = message => {
const _handleSendResponse = ({ message, state }) => { const _handleSendResponse = ({ message, state }) => {
delete registry[`${messageTypes.SEND}-${message.id}`] delete registry[`${messageTypes.SEND}-${message.id}`]
const { identityFailure } = get(message, 'data[0]') if (get(message, 'data.0.identityFailure')) {
if (identityFailure) {
return _updateFingerprint(message, state) return _updateFingerprint(message, state)
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment