- commit
- 2fbb7d1
- parent
- 0d05547
- author
- Eric Bower
- date
- 2025-09-17 10:17:10 -0400 EDT
fix(pico): check if entry or entry.Reader is nil
I'm not sure why we would ever receive a nil entry but it is showing up
in the logs
```
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x9a258]
goroutine 14513 [running]:
io.ReadAll({0x0, 0x0})
/usr/local/go/src/io/io.go:712 +0x58
github.com/picosh/pico/pkg/apps/pico.(*UploadHandler).Write(0x400000c198, 0x400045eb90, 0x4000990960)
/app/pkg/apps/pico/file_handler.go:305 +0xfc
github.com/picosh/pico/pkg/send/protocols/sftp.(*handler).Filecmd(0x4000f67b30, 0x40015c8b60?)
/app/pkg/send/protocols/sftp/handler.go:53 +0x84
github.com/picosh/pico/pkg/send/protocols/sftp.(*handlererr).Filecmd(0x4000a5e0a0, 0xe0?)
```
1 files changed,
+4,
-0
+4,
-0
1@@ -289,6 +289,10 @@ func (h *UploadHandler) Write(s *pssh.SSHServerConnSession, entry *sendutils.Fil
2 logger := pssh.GetLogger(s)
3 user := pssh.GetUser(s)
4
5+ if entry == nil || entry.Reader == nil {
6+ return "", fmt.Errorf("file entry is nil, no file to update")
7+ }
8+
9 if user == nil {
10 err := fmt.Errorf("could not get user from ctx")
11 logger.Error("error getting user from ctx", "err", err)