Skip to content

Commit

Permalink
Merge pull request #31079 from Expensify/jasper-fixCrashToLowerCase
Browse files Browse the repository at this point in the history
[CP Staging] Fix crash on staging with rendering html
  • Loading branch information
roryabraham authored Nov 8, 2023
2 parents 01759d1 + 97d9087 commit 5e286c0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/components/HTMLEngineProvider/htmlEngineUtils.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import lodashGet from 'lodash/get';

const MAX_IMG_DIMENSIONS = 512;

/**
Expand Down Expand Up @@ -52,7 +54,7 @@ function isChildOfNode(tnode, predicate) {
* @returns {Boolean}
*/
function isChildOfComment(tnode) {
return isChildOfNode(tnode, (node) => isCommentTag(node.domNode.name));
return isChildOfNode(tnode, (node) => isCommentTag(lodashGet(node, 'domNode.name', '')));
}

/**
Expand All @@ -62,7 +64,7 @@ function isChildOfComment(tnode) {
* @returns {Boolean}
*/
function isChildOfH1(tnode) {
return isChildOfNode(tnode, (node) => node.domNode.name.toLowerCase() === 'h1');
return isChildOfNode(tnode, (node) => lodashGet(node, 'domNode.name', '').toLowerCase() === 'h1');
}

export {computeEmbeddedMaxWidth, isChildOfComment, isCommentTag, isChildOfH1};

0 comments on commit 5e286c0

Please sign in to comment.