Skip to content

Commit fe86add

Browse files
committed
fix(issue-pr-ref): handle unexisting comment number in issue/pr URL
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
1 parent 88fc478 commit fe86add

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

lib/Reference/GithubIssuePrReferenceProvider.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,14 @@ private function getCommentId(string $urlEnd): ?int {
294294
*/
295295
private function getCommentInfo(string $owner, string $repo, string $end): ?array {
296296
$commentId = $this->getCommentId($end);
297-
return $commentId !== null ? $this->githubAPIService->getIssueCommentInfo($this->userId, $owner, $repo, $commentId) : null;
297+
if ($commentId === null) {
298+
return null;
299+
}
300+
$commentInfo = $this->githubAPIService->getIssueCommentInfo($this->userId, $owner, $repo, $commentId);
301+
if (isset($commentInfo['error'])) {
302+
return null;
303+
}
304+
return $commentInfo;
298305
}
299306

300307
/**

0 commit comments

Comments
 (0)