Skip to content

Conversation

@majiayu000
Copy link

Summary

This PR fixes #36211

Changes

  • Added proper nil check for GetRepository() in SyncPushMirror function
  • Prevents nil pointer dereference when constructing process description
  • Ensures repository names are properly displayed in system messages

When a push mirror's repository no longer exists, the previous code ignored the return value of GetRepository(), which could lead to nil pointer access when constructing the process description at line 102. This resulted in empty repository names in system messages.

This fix checks if GetRepository() returns nil and exits early with an error log, preventing the use of nil repository fields.


Generated with Claude Code

When a push mirror's repository no longer exists, the previous code
ignored the return value of GetRepository(), leading to nil pointer
access when constructing the process description. This resulted in
empty repository names in system messages.

This fix checks if GetRepository() returns nil and exits early with
an error log, preventing the use of nil repository fields.

Fixes go-gitea#36211

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Signed-off-by: majiayu000 <1835304752@qq.com>
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Dec 30, 2025
@github-actions github-actions bot added the modifies/go Pull requests that update Go code label Dec 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. modifies/go Pull requests that update Go code

2 participants