From 38301b9f7d3d2618f5482c5b8a9aae7ba76bc7ab Mon Sep 17 00:00:00 2001 From: Marc Glasser Date: Wed, 27 Jul 2022 09:20:17 -1000 Subject: [PATCH] Add safer access of message html property in isDeletedAction --- src/libs/ReportActionsUtils.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libs/ReportActionsUtils.js b/src/libs/ReportActionsUtils.js index 066cf4970776..29f22e0f68c0 100644 --- a/src/libs/ReportActionsUtils.js +++ b/src/libs/ReportActionsUtils.js @@ -1,3 +1,4 @@ +import lodashGet from 'lodash/get'; import _ from 'underscore'; import CONST from '../CONST'; @@ -7,7 +8,8 @@ import CONST from '../CONST'; */ function isDeletedAction(reportAction) { // A deleted comment has either an empty array or an object with html field with empty string as value - return reportAction.message.length === 0 || reportAction.message[0].html === ''; + const message = lodashGet(reportAction, 'message', []); + return message.length === 0 || lodashGet(message, [0, 'html']) === ''; } /**