diff --git a/templates/repo/header.tmpl b/templates/repo/header.tmpl
index beea89399e..4e92532bde 100644
--- a/templates/repo/header.tmpl
+++ b/templates/repo/header.tmpl
@@ -39,7 +39,7 @@
{{end}}
- {{if $.IsPullMirror}}
+ {{if and $.IsPullMirror $.Mirror}}
{{$address := MirrorRemoteAddress $.Context . $.Mirror.GetRemoteName false}}
{{end}}
diff --git a/templates/repo/settings/options.tmpl b/templates/repo/settings/options.tmpl
index 0a64492d36..e205b9330d 100644
--- a/templates/repo/settings/options.tmpl
+++ b/templates/repo/settings/options.tmpl
@@ -88,7 +88,7 @@
{{end}}
- {{if .Repository.IsMirror}}
+ {{if and .Repository.IsMirror .Mirror}}
{{(MirrorRemoteAddress $.Context .Repository .Mirror.GetRemoteName false).Address}} |