From 90ed1f797ea6daa149e535700763f3e0fa8de2db Mon Sep 17 00:00:00 2001 From: Asuka Minato Date: Sat, 31 Aug 2024 00:23:21 +0900 Subject: [PATCH] add error handling --- src/croc/croc.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/croc/croc.go b/src/croc/croc.go index 0a3555fb..57e102d8 100644 --- a/src/croc/croc.go +++ b/src/croc/croc.go @@ -1737,6 +1737,9 @@ func (c *Client) createEmptyFileAndFinish(fileInfo FileInfo, i int) (err error) description = " " + description } width, _, err := term.GetSize(int(os.Stdout.Fd())) + if err != nil { + return + } if len(description) > width { description = description[:(width-3)] + "..." } @@ -1916,7 +1919,10 @@ func (c *Client) setBar() { } else if !c.Options.IsSender { description = " " + description } - width, _, _ := term.GetSize(int(os.Stdout.Fd())) + width, _, err := term.GetSize(int(os.Stdout.Fd())) + if err != nil { + return + } description = strings.TrimSpace(description) if len(description) > width { description = description[:(width-3)] + "..."