From 4f416bf943bbb8c917015ac908b12e0a5689711b Mon Sep 17 00:00:00 2001 From: bitcodr Date: Fri, 31 Jul 2020 19:10:09 +0430 Subject: [PATCH] Fix nil error issue --- cmd/fscrypt/errors.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/fscrypt/errors.go b/cmd/fscrypt/errors.go index 10d744a4..65e76442 100644 --- a/cmd/fscrypt/errors.go +++ b/cmd/fscrypt/errors.go @@ -287,6 +287,10 @@ func getErrorSuggestions(err error) string { // returned error prepends an error tag and the name of the relevant command, // and it will make fscrypt return a non-zero exit value. func newExitError(c *cli.Context, err error) error { + if err == nil { + return nil + } + // Prepend the error tag and full name, and append suggestions (if any) prefix := "[ERROR] " + getFullName(c) + ": " message := prefix + wrapText(err.Error(), utf8.RuneCountInString(prefix))