NPE on show pull with unclear cause #7084

Closed
opened 2025-11-02 07:15:28 -06:00 by GiteaMirror · 0 comments
Owner

Originally created by @zeripath on GitHub (Mar 29, 2021).

template: repo/issue/view_content/comments:470:20: executing "repo/issue/view_content/comments" at <CommentMustAsDiff (index $comms 0)>: error calling CommentMustAsDiff: PANIC whilst retrieving diff for comment[775] Error: runtime error: invalid memory address or nil pointer dereference
Stack: /usr/local/go/src/runtime/panic.go:212 (0x4565b2)
/usr/local/go/src/runtime/signal_unix.go:742 (0x456432)
/go/src/code.gitea.io/gitea/services/gitdiff/gitdiff.go:1029 (0x1830a99)
/go/src/code.gitea.io/gitea/services/gitdiff/gitdiff.go:856 (0x182eb04)
/go/src/code.gitea.io/gitea/services/gitdiff/gitdiff.go:1267 (0x183357c)
/go/src/code.gitea.io/gitea/services/gitdiff/gitdiff.go:1295 (0x1833867)
/usr/local/go/src/reflect/value.go:476 (0x4a6fe6)

Description

There is an issue whereby some code review comments can cause a panic when trying to render the comments on the page.

These issues were reported by @miili @skillcoder on #14812 but I have not been able to get more information from them regarding this. (In particular it would be helpful to see examples of the comment table to figure this out.) I have even emailed the administrator of the pyrocko server and have had no response.

However, #15086 has allowed me to discover what the proximal issue is despite the lack of further information. It appears that there is an NPE here:

8d4f8ebf31/services/gitdiff/gitdiff.go (L1029)

I don't understand how this can happen as there should always be a hunk header line - however, without actually seeing the patch that causes the problem or any way to replicate it on master/1.14/1.13 I have little other option than to dumbly attempt to work around the issue.

So please @miili @skillcoder would you show me the contents of the comment table that are associated with the issue that cause this.

Originally created by @zeripath on GitHub (Mar 29, 2021). - Gitea version (or commit ref): 1.13.6 - Git version: ? - Operating system: ? - Database (use `[x]`): - [x] PostgreSQL - [x] MySQL - [x] MSSQL - [x] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [x] No - https://git.pyrocko.org/pyrocko/pyrocko/pulls/159 - Log gist: ``` template: repo/issue/view_content/comments:470:20: executing "repo/issue/view_content/comments" at <CommentMustAsDiff (index $comms 0)>: error calling CommentMustAsDiff: PANIC whilst retrieving diff for comment[775] Error: runtime error: invalid memory address or nil pointer dereference Stack: /usr/local/go/src/runtime/panic.go:212 (0x4565b2) /usr/local/go/src/runtime/signal_unix.go:742 (0x456432) /go/src/code.gitea.io/gitea/services/gitdiff/gitdiff.go:1029 (0x1830a99) /go/src/code.gitea.io/gitea/services/gitdiff/gitdiff.go:856 (0x182eb04) /go/src/code.gitea.io/gitea/services/gitdiff/gitdiff.go:1267 (0x183357c) /go/src/code.gitea.io/gitea/services/gitdiff/gitdiff.go:1295 (0x1833867) /usr/local/go/src/reflect/value.go:476 (0x4a6fe6) ``` ## Description There is an issue whereby some code review comments can cause a panic when trying to render the comments on the page. These issues were reported by @miili @skillcoder on #14812 but I have not been able to get more information from them regarding this. (In particular it would be helpful to see examples of the comment table to figure this out.) I have even emailed the administrator of the pyrocko server and have had no response. However, #15086 has allowed me to discover what the proximal issue is despite the lack of further information. It appears that there is an NPE here: https://github.com/go-gitea/gitea/blob/8d4f8ebf3105811f9d4fe6338f32ecc5c0b76452/services/gitdiff/gitdiff.go#L1029 I don't understand how this can happen as there should always be a hunk header line - however, without actually seeing the patch that causes the problem or any way to replicate it on master/1.14/1.13 I have little other option than to dumbly attempt to work around the issue. So please @miili @skillcoder would you show me the contents of the comment table that are associated with the issue that cause this.
GiteaMirror added the type/bug label 2025-11-02 07:15:28 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#7084