Always happen nil exception when exit after I enable metadata plugin
Describe the bug As the head says, when I disable the metadata plugin, the exception disappear.
To Reproduce Steps to reproduce the behavior:
- Go to set 'theme = tokyonight; metadata=true'
- 'spf; q'
- See error
Expected behavior Caught panic:
runtime error: invalid memory address or nil pointer dereference
Restoring terminal...
goroutine 1 [running]: runtime/debug.Stack() /usr/lib/golang/src/runtime/debug/stack.go:24 +0x5e runtime/debug.PrintStack() /usr/lib/golang/src/runtime/debug/stack.go:16 +0x13 github.com/charmbracelet/bubbletea.(*Program).Run.func1() /home/yorukot/go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:519 +0x91 panic({0x142e360?, 0x1ea78e0?}) /usr/lib/golang/src/runtime/panic.go:770 +0x132 github.com/barasher/go-exiftool.(*Exiftool).Close(0x0) /home/yorukot/go/pkg/mod/github.com/barasher/[email protected]/exiftool.go:99 +0x41 github.com/yorukot/superfile/src/internal.model.quitSuperfile({{{0xc0003b4008, 0x1, 0x1}, 0x31, 0x0, 0x2, {0x1, 0x2f}}, {{0xc000146e00, 0xa, ...}, ...}, ...}) /home/yorukot/Documents/code/superfile/src/internal/model.go:358 +0x2e github.com/yorukot/superfile/src/internal.model.handleKeyInput({{{0xc0003b4008, 0x1, 0x1}, 0x31, 0x0, 0x2, {0x1, 0x2f}}, {{0xc000146e00, 0xa, ...}, ...}, ...}, ...) /home/yorukot/Documents/code/superfile/src/internal/model.go:190 +0x8d9 github.com/yorukot/superfile/src/internal.model.Update({{{0xc0003b4008, 0x1, 0x1}, 0x31, 0x0, 0x2, {0x1, 0x2f}}, {{0xc000146e00, 0xa, ...}, ...}, ...}, ...) /home/yorukot/Documents/code/superfile/src/internal/model.go:58 +0x37c github.com/charmbracelet/bubbletea.(*Program).eventLoop(0xc000612120, {0x18d9450?, 0xc0003b6a88?}, 0xc0000961e0) /home/yorukot/go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:452 +0x7f0 github.com/charmbracelet/bubbletea.(*Program).Run(0xc000612120) /home/yorukot/go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:593 +0xa52 github.com/yorukot/superfile/src/cmd.Run.func2(0xc0003b2880) /home/yorukot/Documents/code/superfile/src/cmd/main.go:70 +0x179 github.com/urfave/cli/v2.(*Command).Run(0xc00017e580, 0xc0003b2880, {0xc000034090, 0x1, 0x1}) /home/yorukot/go/pkg/mod/github.com/urfave/cli/[email protected]/command.go:276 +0x97d github.com/urfave/cli/v2.(*App).RunContext(0xc000146400, {0x18da010, 0x1f6cbe0}, {0xc000034090, 0x1, 0x1}) /home/yorukot/go/pkg/mod/github.com/urfave/cli/[email protected]/app.go:333 +0x5a5 github.com/urfave/cli/v2.(*App).Run(...) /home/yorukot/go/pkg/mod/github.com/urfave/cli/[email protected]/app.go:307 github.com/yorukot/superfile/src/cmd.Run({0xc000076000?}) /home/yorukot/Documents/code/superfile/src/cmd/main.go:79 +0x2c6 main.main() /home/yorukot/Documents/code/superfile/main.go:15 +0x1a
Screenshots If applicable, add screenshots to help explain your problem.
System information (please complete the following information):
- OS: win11
- Superfile Version v1.1.5
And my theme setting don't work yet. I don't know whether it is a bug.
Needs investigation. Need to investigate metadata plugin in windows
Able to reproduce.
╰────────────────────╯╰─────────────────────┤ Name├─┤ Browser├─┤35/40├╯
╭─┤ Processes ├────────────────────────╮╭─┤ Metadata ├─────────────────────────╮╭─┤ Clipboard ├────────────────────────╮
│ ││This is...k file. ││ │
│ No processes running ││ ││ No content in clipboard │
│ ││ ││ ││ ││ ││ │
│ ││ ││ │
│ ││ ││ │
panic: runtime error: invalid memory address or nil pointer dereference──┤1/1├─╯╰──────────────────────────────────────╯
[signal 0xc0000005 code=0x0 addr=0x0 pc=0x7ff641a02c54]
goroutine 166 [running]:
github.com/barasher/go-exiftool.(*Exiftool).ExtractMetadata(0x4000394c80?, {0x40003abf28?, 0x0?, 0x0?})
/home/yorukot/go/pkg/mod/github.com/barasher/[email protected]/exiftool.go:145 +0x34
github.com/yorukot/superfile/src/internal.(*model).returnMetaData(0x400045f508)
/home/yorukot/Documents/code/superfile/src/internal/function.go:360 +0x780
github.com/yorukot/superfile/src/internal.(*model).mainKey.func1()
/home/yorukot/Documents/code/superfile/src/internal/key_function.go:32 +0x20
created by github.com/yorukot/superfile/src/internal.(*model).mainKey in goroutine 1
/home/yorukot/Documents/code/superfile/src/internal/key_function.go:31 +0x1ac
PS C:\Users\nitin>
Just create any file with .dat extension, and you will see crash while you try to see that file's metadata
If exiftool is not there, it shouldn't crash at least.
Same crash in linux too, when exiftool is not found
panic: runtime error: invalid memory address or nil pointer dereference──────────────────────────────┤1/3├─╯╰────────────────────────────────────────────────────╯
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x7ca63d]
goroutine 113 [running]:
github.com/barasher/go-exiftool.(*Exiftool).ExtractMetadata(0x0, {0xc0003d7f20, 0x1, 0x18306e0?})
/home/yorukot/go/pkg/mod/github.com/barasher/[email protected]/exiftool.go:145 +0x5d
github.com/yorukot/superfile/src/internal.(*model).returnMetaData(0xc00044a008)
/home/yorukot/Documents/code/superfile/src/internal/function.go:360 +0x898
github.com/yorukot/superfile/src/internal.(*model).mainKey.func2()
/home/yorukot/Documents/code/superfile/src/internal/key_function.go:48 +0x17
created by github.com/yorukot/superfile/src/internal.(*model).mainKey in goroutine 1
/home/yorukot/Documents/code/superfile/src/internal/key_function.go:47 +0x37b
[opc@test-client-hyd-1 ~]$
Verfied that crash doesn't happens after the fix.
@Zim-Inn Thanks for the bug report. This has been fixed. Can you do a local build spf from the main branch and see if the issue if fixed for you ?
@Zim-Inn Closing this. Please feel free to reopen if you still face the issue.