hugo

Unnamed repository; edit this file 'description' to name the repository.

git clone git://git.shimmy1996.com/hugo.git
commit 5e0a16ea21c4467e809d6369bd1971661713f068
parent 029a3ae79e9f1d53a3cbcf577ce65dbf9e4cf6ca
Author: Austin Ziegler <austin@zieglers.ca>
Date:   Fri, 26 Dec 2014 11:55:53 -0500

Fix a crash for ref page#anchor.

- Remove an improperly shadowed variable.
- Fixes #741.

Diffstat:
Mhugolib/site.go | 4+---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/hugolib/site.go b/hugolib/site.go
@@ -160,8 +160,6 @@ func (s *SiteInfo) refLink(ref string, page *Page, relative bool) (string, error
 	var link string = ""
 
 	if refUrl.Path != "" {
-		var target *Page
-
 		for _, page := range []*Page(*s.Pages) {
 			if page.Source.Path() == refUrl.Path || page.Source.LogicalName() == refUrl.Path {
 				target = page
@@ -187,7 +185,7 @@ func (s *SiteInfo) refLink(ref string, page *Page, relative bool) (string, error
 	if refUrl.Fragment != "" {
 		link = link + "#" + refUrl.Fragment
 
-		if refUrl.Path != "" {
+		if refUrl.Path != "" && target != nil {
 			link = link + ":" + target.UniqueId()
 		} else if page != nil {
 			link = link + ":" + page.UniqueId()