]> source.dussan.org Git - gitea.git/commit
Prevent NPE on update mirror settings (#19864)
authorzeripath <art27@cantab.net>
Thu, 2 Jun 2022 16:56:32 +0000 (17:56 +0100)
committerGitHub <noreply@github.com>
Thu, 2 Jun 2022 16:56:32 +0000 (12:56 -0400)
commite32ab429ffd863f26d2ea884307bcf2c7064d209
treef1b52fc46b6e6bab0cbf59b7056d3783d20851c0
parent6171ea7d318c0ca8714bc6efd6a97ea4b495eb6d
Prevent NPE on update mirror settings (#19864)

A `repo_model.Mirror` repository field (`.Repo`) will not automatically
be set, but is used without checking in mirror_pull.go:UpdateAddress.
This will cause an NPE.

This PR changes UpdateAddress to use the helper function GetRepository()
helping prevent future NPEs but also changes modules/context/repo.go to
ensure that the Mirror.Repo is set.

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
modules/context/repo.go
services/mirror/mirror_pull.go