Skip to content

Commit

Permalink
fix(contentscript): avoid null access
Browse files Browse the repository at this point in the history
fixes #335
  • Loading branch information
sanemat committed May 30, 2024
1 parent 0b92137 commit 92a6ed2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/scripts/contentscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

function changeMergeButtonState() {
let container = document.querySelector('#js-repo-pjax-container');
let issueTitle = container.querySelector('.js-issue-title').textContent;
let issueTitle = container.querySelector('.js-issue-title')?.textContent;
let buttonMerges = container.querySelectorAll('.merge-message button[data-details-container]');
let buttonMergeOptions = container.querySelectorAll('.merge-message button[data-details-container] + .select-menu-button');
let disabled = false;
Expand All @@ -17,7 +17,7 @@
const wipTagRegex = /(wip|do\s*not\s*merge|dnm)/i;

const isWipTitle = wipTitleRegex.test(issueTitle);
const isWipTaskList = container.querySelector('.timeline-comment') && container.querySelector('.timeline-comment').querySelector('input[type="checkbox"]:not(:checked)') !== null;
const isWipTaskList = container.querySelector('.timeline-comment') && container.querySelector('.timeline-comment')?.querySelector('input[type="checkbox"]:not(:checked)') !== null;
let isSquashCommits = false;
for (const commitMessage of container.querySelectorAll('.commit-message')) {
isSquashCommits = isSquashCommits || commitMessage.textContent.match(/(squash|fixup)!/);
Expand Down

0 comments on commit 92a6ed2

Please sign in to comment.