Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unsupported provider caused panic #107

Open
quantonganh opened this issue Oct 1, 2024 · 3 comments
Open

Unsupported provider caused panic #107

quantonganh opened this issue Oct 1, 2024 · 3 comments

Comments

@quantonganh
Copy link

Given the following config:

[[database]]
Name = 'local/taskwarrior'
Provider = 'sqlite'
DBName = 'taskchampion'
URL = 'file:~/.task/taskchampion.sqlite3?loc=auto'

(The provider should be sqlite3 instead of sqlite)

This caused panic when connecting:

                                                          ║Connecting...panic: runtime error: invalid memory address or nil pointer dereference
                                                          ║                                                        ║                           [signal SIGSEGV: segmentation violation code=0x2 addr=0x18 pc=0x104d08c2c]                ║                                                        ║
                                                          ║┌────────┐ ┌────────┐ ┌────────┐ ┌────────┐ ┌─────────┐ ║
                                          goroutine 33 [running]:w  │ │ Connect│ │  Edit  │ │ Delete │ │  Quit   │ ║
                                                          ║└─────github.com/jorgerojas26/lazysql/components.(*ConnectionSelection).Connect(0x14000010a10, {{0x1400001c2d0, 0x11}, {0x1400000f0b0, 0x6}, {0x1400000f0c0, 0xc}, {0x14000016780, 0x2a}})═════════════════════════════════════════════╝
                                                                        /home/runner/work/lazysql/lazysql/components/ConnectionSelection.go:162 +0x41c
                                                                                                                                                      created by github.com/jorgerojas26/lazysql/components.NewConnectionSelection.func1 in goroutine 1
                                                                                /home/runner/work/lazysql/lazysql/components/ConnectionSelection.go:89 +0x370
@jorgerojas26
Copy link
Owner

That config schema is outdated, please upgrade to the latest lazysql version and try to add the connection again.

@quantonganh
Copy link
Author

Although pressing F1 saves the correct config file, we should still handle unsupported providers to prevent the app from crashing in case someone modifies it manually.

@jorgerojas26
Copy link
Owner

Your PR does not solve it correctly. The provider can be inferred from the URL string. I'm leaving this issue open because i think this should be resolved and will work on this eventually. If you want to make another PR i'm willing to help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants