Fixed unhandled error return value

This commit is contained in:
Seednode 2022-10-18 16:46:55 -05:00
parent c8971f5187
commit 022b14bfa2
2 changed files with 10 additions and 4 deletions

View File

@ -82,6 +82,9 @@ func getLastFile(p Path) (string, error) {
p.Decrement() p.Decrement()
fileName, err = tryExtensions(p) fileName, err = tryExtensions(p)
if err != nil {
return "", err
}
break break
} }
@ -113,6 +116,9 @@ func getPreviousFile(p Path) (string, error) {
} }
func splitPath(path string) (Path, error) { func splitPath(path string) (Path, error) {
p := Path{}
var err error
re := regexp.MustCompile(`(.+)([0-9]{3})(\..+)`) re := regexp.MustCompile(`(.+)([0-9]{3})(\..+)`)
split := re.FindAllStringSubmatch(path, -1) split := re.FindAllStringSubmatch(path, -1)
@ -121,14 +127,13 @@ func splitPath(path string) (Path, error) {
return Path{}, nil return Path{}, nil
} }
p := Path{}
var err error
p.Base = split[0][1] p.Base = split[0][1]
p.Number, err = strconv.Atoi(split[0][2]) p.Number, err = strconv.Atoi(split[0][2])
if err != nil { if err != nil {
return Path{}, err return Path{}, err
} }
p.Extension = split[0][3] p.Extension = split[0][3]
return p, nil return p, nil
@ -303,6 +308,7 @@ func pickFile(args []string, filter, sorting string) (string, error) {
if err != nil { if err != nil {
return "", err return "", err
} }
if isImage { if isImage {
return filePath, nil return filePath, nil
} }

View File

@ -10,7 +10,7 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
var Version = "0.13.1" var Version = "0.13.2"
func init() { func init() {
rootCmd.AddCommand(versionCmd) rootCmd.AddCommand(versionCmd)