Skip to content

Commit 92a6ed2

Browse files
committed
fix(contentscript): avoid null access
fixes #335
1 parent 0b92137 commit 92a6ed2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

app/scripts/contentscript.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

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

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

0 commit comments

Comments
 (0)