Skip to content

Commit

Permalink
fix: check length of var first
Browse files Browse the repository at this point in the history
  • Loading branch information
kha7iq committed May 26, 2023
1 parent 23d2528 commit cd5b982
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions internal/helper/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,11 @@ func IsPathValid(path string) (bool, error) {
}
}

// TrimSAH

// TrimSAH will check the commit and if its not empty trim.
func TrimSHA(commitSHA string) string {
shortSHA := commitSHA[:12]
return shortSHA
if len(commitSHA) > 0 {
shortSHA := commitSHA[:12]
return shortSHA
}
return ""
}

0 comments on commit cd5b982

Please sign in to comment.