mirror of
https://github.com/restic/restic.git
synced 2024-12-26 17:57:50 +00:00
avoid "index out of range" error
in case of len(format) == 0, we will get an "index out of range" error Usage of strings.HasSuffix is allowing to avoid that
This commit is contained in:
parent
38ddfbc4d3
commit
688014487b
1 changed files with 1 additions and 1 deletions
|
@ -232,7 +232,7 @@ func Warnf(format string, args ...interface{}) {
|
||||||
// Exitf uses Warnf to write the message and then terminates the process with
|
// Exitf uses Warnf to write the message and then terminates the process with
|
||||||
// the given exit code.
|
// the given exit code.
|
||||||
func Exitf(exitcode int, format string, args ...interface{}) {
|
func Exitf(exitcode int, format string, args ...interface{}) {
|
||||||
if format[len(format)-1] != '\n' {
|
if !(strings.HasSuffix(format, "\n")) {
|
||||||
format += "\n"
|
format += "\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue