Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(contentscript): avoid null access #358

Merged
merged 2 commits into from
May 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading