Skip to content

Commit

Permalink
fix(#330): fix panic error when abort pipeline which has no log (#331)
Browse files Browse the repository at this point in the history
  • Loading branch information
supereagle committed Jan 26, 2018
1 parent 5985a9b commit 7fd8f6e
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions pkg/event/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,15 @@ func postHookEvent(event *api.Event) {

// generateAbortedStateLog generates aborted state log for last stage to illustrate that the record is aborted.
func generateAbortedStateLog(log string) string {
subLogs := log[strings.LastIndex(log, "\nstep: "):]
i := strings.Index(subLogs, " state: ")
additionalLog := subLogs[1:i+8] + "aborted\n"
if strings.Contains(log, "\nstep: ") && strings.Contains(log, " state: ") {
subLogs := log[strings.LastIndex(log, "\nstep: "):]
i := strings.Index(subLogs, " state: ")
additionalLog := subLogs[1:i+8] + "aborted\n"

return additionalLog
return additionalLog
}

return ""
}

// createServiceHander is the create service handler.
Expand Down

0 comments on commit 7fd8f6e

Please sign in to comment.