Skip to content

Commit

Permalink
🐛 fix parentNode null bug with optional chaining
Browse files Browse the repository at this point in the history
  • Loading branch information
heytulsiprasad committed Oct 7, 2020
1 parent faaf12e commit 866201c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions content.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,12 @@ try {

newNodes.forEach((node) => {
if (node.classList && node.classList.contains("CNusmb")) {
const speaker = node.parentNode.parentNode.parentNode.parentNode.querySelector(
const speaker = node?.parentNode?.parentNode?.parentNode?.parentNode?.querySelector(
".zs7s8d.jxFHg"
).textContent;
const photo = node.parentNode.parentNode.parentNode.parentNode
.querySelector(".KpxDtd.r6DyN")
.getAttribute("src");
)?.textContent;
const photo = node?.parentNode?.parentNode?.parentNode?.parentNode
?.querySelector(".KpxDtd.r6DyN")
?.getAttribute("src");
const speech = node.textContent;

// Get image base64 from url
Expand Down

0 comments on commit 866201c

Please sign in to comment.