summaryrefslogtreecommitdiffstats
path: root/models/issue.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/issue.go')
-rw-r--r--models/issue.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/models/issue.go b/models/issue.go
index 17ec0a6888..de7ac8c9f0 100644
--- a/models/issue.go
+++ b/models/issue.go
@@ -332,6 +332,13 @@ func (issue *Issue) GetIsRead(userID int64) error {
// APIURL returns the absolute APIURL to this issue.
func (issue *Issue) APIURL() string {
+ if issue.Repo == nil {
+ err := issue.LoadRepo()
+ if err != nil {
+ log.Error("Issue[%d].APIURL(): %v", issue.ID, err)
+ return ""
+ }
+ }
return fmt.Sprintf("%s/issues/%d", issue.Repo.APIURL(), issue.Index)
}