What happened?
Panic when receiving with --stdout and invalid CROC_SECRET
What did you expect to happen?
The program should handle invalid secrets gracefully and exit with an appropriate error message.
Steps to reproduce
- Run croc receiver with
--stdout flag and an invalid secret:
CROC_SECRET=asdbajhdad ./croc --stdout
- The program panics instead of handling the error gracefully
croc version
v10.2.7
Operating System
Linux
OS Version
Debian 13
Relevant log output
$ CROC_SECRET=asdbajhdad ./croc
securing channel...room (secure channel) not ready, maybe peer disconnected
$ CROC_SECRET=asdbajhdad ./croc --stdout
securing channel...panic: runtime error: index out of range [0] with length 0
goroutine 38 [running]:
github.com/schollz/croc/v10/src/croc.(*Client).transfer(0xc00030a008)
/home/runner/work/croc/croc/src/croc/croc.go:1180 +0x8d1
github.com/schollz/croc/v10/src/croc.(*Client).Receive(0xc00030a008)
/home/runner/work/croc/croc/src/croc/croc.go:1102 +0x1432
github.com/schollz/croc/v10/src/cli.receive(0xc0001312c0)
/home/runner/work/croc/croc/src/cli/cli.go:709 +0xd69
github.com/schollz/croc/v10/src/cli.Run.func1(0xc0001312c0)
/home/runner/work/croc/croc/src/cli/cli.go:206 +0x505
github.com/schollz/cli/v2.(*App).RunContext(0xc00012c600, {0xa705f8, 0xe5eb40}, {0xc00010e080, 0x2, 0x2})
/home/runner/go/pkg/mod/github.com/schollz/cli/v2@v2.2.1/app.go:315 +0x90d
github.com/schollz/cli/v2.(*App).Run(...)
/home/runner/go/pkg/mod/github.com/schollz/cli/v2@v2.2.1/app.go:217
github.com/schollz/croc/v10/src/cli.Run()
/home/runner/work/croc/croc/src/cli/cli.go:209 +0x15e5
main.main.func1()
/home/runner/work/croc/croc/main.go:40 +0x13
created by main.main in goroutine 1
/home/runner/work/croc/croc/main.go:39 +0x71
Additional context
No response
What happened?
Panic when receiving with --stdout and invalid CROC_SECRET
What did you expect to happen?
The program should handle invalid secrets gracefully and exit with an appropriate error message.
Steps to reproduce
--stdoutflag and an invalid secret:croc version
v10.2.7
Operating System
Linux
OS Version
Debian 13
Relevant log output
Additional context
No response