[PR #2352] [MERGED] fix: prevent nil pointer panic in HandleTaskUpdatedMentions listener #5622

Closed
opened 2026-04-16 13:44:33 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/go-vikunja/vikunja/pull/2352
Author: @tink-bot
Created: 3/4/2026
Status: Merged
Merged: 3/4/2026
Merged by: @kolaente

Base: mainHead: fix-nil-panic-mentions


📝 Commits (1)

  • 4446d6c fix: prevent nil pointer panic in mention notification listeners

📊 Changes

3 files changed (+36 additions, -5 deletions)

View changed files

📝 pkg/models/kanban_task_bucket.go (+7 -5)
📝 pkg/models/listeners.go (+16 -0)
📝 pkg/models/mentions_test.go (+13 -0)

📄 Description

Summary

  • Fixes a nil pointer dereference panic in HandleTaskUpdatedMentions (and related mention handlers) reported via Sentry
  • Root cause: TaskBucket.Update dispatched a TaskUpdatedEvent with nil Task when updateTaskBucket returned early (no bucket change), leaving b.Task unset
  • Added nil guard at the event dispatch site in kanban_task_bucket.go to prevent the nil event from being sent
  • Added defensive nil checks in four event listeners (HandleTaskUpdatedMentions, HandleTaskCreateMentions, HandleTaskCommentEditMentions, UpdateTaskInSavedFilterViews) for defense in depth
  • Added unit tests verifying all three mention handlers gracefully handle nil task events

Test plan

  • New unit tests pass: TestHandleMentionsWithNilTask with subtests for all three mention handlers
  • Existing feature tests pass (mage test:feature)
  • Linter passes (only pre-existing frontend/embed.go issue, unrelated)

Closes #2351


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/go-vikunja/vikunja/pull/2352 **Author:** [@tink-bot](https://github.com/tink-bot) **Created:** 3/4/2026 **Status:** ✅ Merged **Merged:** 3/4/2026 **Merged by:** [@kolaente](https://github.com/kolaente) **Base:** `main` ← **Head:** `fix-nil-panic-mentions` --- ### 📝 Commits (1) - [`4446d6c`](https://github.com/go-vikunja/vikunja/commit/4446d6cec1a354d563b0af8e18e21735a3118284) fix: prevent nil pointer panic in mention notification listeners ### 📊 Changes **3 files changed** (+36 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `pkg/models/kanban_task_bucket.go` (+7 -5) 📝 `pkg/models/listeners.go` (+16 -0) 📝 `pkg/models/mentions_test.go` (+13 -0) </details> ### 📄 Description ## Summary - Fixes a nil pointer dereference panic in `HandleTaskUpdatedMentions` (and related mention handlers) reported via Sentry - Root cause: `TaskBucket.Update` dispatched a `TaskUpdatedEvent` with nil `Task` when `updateTaskBucket` returned early (no bucket change), leaving `b.Task` unset - Added nil guard at the event dispatch site in `kanban_task_bucket.go` to prevent the nil event from being sent - Added defensive nil checks in four event listeners (`HandleTaskUpdatedMentions`, `HandleTaskCreateMentions`, `HandleTaskCommentEditMentions`, `UpdateTaskInSavedFilterViews`) for defense in depth - Added unit tests verifying all three mention handlers gracefully handle nil task events ## Test plan - [x] New unit tests pass: `TestHandleMentionsWithNilTask` with subtests for all three mention handlers - [x] Existing feature tests pass (`mage test:feature`) - [x] Linter passes (only pre-existing `frontend/embed.go` issue, unrelated) Closes #2351 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-16 13:44:33 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/vikunja#5622