aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2018-12-02 17:51:24 -0500
committerUnknwon <u@gogs.io>2018-12-02 17:51:24 -0500
commit29c5be47ed9dfd2d72319a6b040bc3768d9f12c9 (patch)
tree1c92794e8c57620f5c2ad3de8a241415517bba10
parente0f18b2255bffa97919cdce88c2586c2024dee0e (diff)
models/issue: fix panic when clear labels (#5445)
-rw-r--r--gogs.go2
-rw-r--r--models/issue.go7
-rw-r--r--templates/.VERSION2
3 files changed, 8 insertions, 3 deletions
diff --git a/gogs.go b/gogs.go
index a433ef24..9c3171d3 100644
--- a/gogs.go
+++ b/gogs.go
@@ -16,7 +16,7 @@ import (
"github.com/gogs/gogs/pkg/setting"
)
-const APP_VER = "0.11.73.1202"
+const APP_VER = "0.11.74.1202"
func init() {
setting.AppVer = APP_VER
diff --git a/models/issue.go b/models/issue.go
index de87080a..b81f384b 100644
--- a/models/issue.go
+++ b/models/issue.go
@@ -314,8 +314,13 @@ func (issue *Issue) clearLabels(e *xorm.Session) (err error) {
return fmt.Errorf("getLabels: %v", err)
}
+ // NOTE: issue.removeLabel slices issue.Labels, so we need to create another slice to be unaffected.
+ labels := make([]*Label, len(issue.Labels))
for i := range issue.Labels {
- if err = issue.removeLabel(e, issue.Labels[i]); err != nil {
+ labels[i] = issue.Labels[i]
+ }
+ for i := range labels {
+ if err = issue.removeLabel(e, labels[i]); err != nil {
return fmt.Errorf("removeLabel: %v", err)
}
}
diff --git a/templates/.VERSION b/templates/.VERSION
index 8b3d065d..5aa190e4 100644
--- a/templates/.VERSION
+++ b/templates/.VERSION
@@ -1 +1 @@
-0.11.73.1202
+0.11.74.1202