浏览代码

Fix NPE when using non-numeric (#20277)

- This code is only valid when `refNumeric` exist(otherwise we didn't find
such numeric PR and can skip that check) and give a free-pas to the  "BEFORE" check when
`ref` is nil.
- Resolves #20109
tags/v1.18.0-rc0
Gusted 1年前
父节点
当前提交
3f513f9e54
没有帐户链接到提交者的电子邮件
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 3
    2
      modules/markup/html.go

+ 3
- 2
modules/markup/html.go 查看文件

@@ -841,9 +841,10 @@ func issueIndexPatternProcessor(ctx *RenderContext, node *html.Node) {

// Repos with external issue trackers might still need to reference local PRs
// We need to concern with the first one that shows up in the text, whichever it is
if hasExtTrackFormat && !isNumericStyle {
if hasExtTrackFormat && !isNumericStyle && refNumeric != nil {
// If numeric (PR) was found, and it was BEFORE the non-numeric pattern, use that
if foundNumeric && refNumeric.RefLocation.Start < ref.RefLocation.Start {
// Allow a free-pass when non-numeric pattern wasn't found.
if found && (ref == nil || refNumeric.RefLocation.Start < ref.RefLocation.Start) {
found = foundNumeric
ref = refNumeric
}

正在加载...
取消
保存