diff --git a/src/githubHelper.ts b/src/githubHelper.ts index edbb68b..baeb065 100644 --- a/src/githubHelper.ts +++ b/src/githubHelper.ts @@ -1707,17 +1707,19 @@ export class GithubHelper { const ref = path && line ? `${path} line ${line}` : `${head_sha}`; let lineRef = `Commented on [${ref}](${repoLink}/compare/${base_sha}..${head_sha}${slug})\n\n`; - if (position.line_range.start.type === 'new') { - const startLine = position.line_range.start.new_line; - const endLine = position.line_range.end.new_line; - const lineRange = (startLine !== endLine) ? `L${startLine}-L${endLine}` : `L${startLine}`; - lineRef += `${repoLink}/blob/${head_sha}/${path}#${lineRange}\n\n`; - } - else { - const startLine = position.line_range.start.old_line; - const endLine = position.line_range.end.old_line; - const lineRange = (startLine !== endLine) ? `L${startLine}-L${endLine}` : `L${startLine}`; - lineRef += `${repoLink}/blob/${head_sha}/${path}#${lineRange}\n\n`; + if (position.line_range) { + if (position.line_range.start.type === 'new') { + const startLine = position.line_range.start.new_line; + const endLine = position.line_range.end.new_line; + const lineRange = (startLine !== endLine) ? `L${startLine}-L${endLine}` : `L${startLine}`; + lineRef += `${repoLink}/blob/${head_sha}/${path}#${lineRange}\n\n`; + } + else { + const startLine = position.line_range.start.old_line; + const endLine = position.line_range.end.old_line; + const lineRange = (startLine !== endLine) ? `L${startLine}-L${endLine}` : `L${startLine}`; + lineRef += `${repoLink}/blob/${head_sha}/${path}#${lineRange}\n\n`; + } } return lineRef; diff --git a/src/settings.ts b/src/settings.ts index b44ce8c..61db4a7 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -35,6 +35,7 @@ export default interface Settings { log: boolean; }; s3?: S3Settings; + commitMap: Record } export interface GithubSettings {