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

quote.Get nil pointer dereferencing when asking quote of a inexistent symbol #21

Open
pallotron opened this issue Jan 23, 2022 · 2 comments

Comments

@pallotron
Copy link
Contributor

Hi,

quote.Get of an inexistent symbol should return a non nil error.
This does not happen....
To repro ask for a quote from a un-existant symbol:

package main

import (
	"fmt"

	"github.com/piquette/finance-go/quote"
)

func main() {
	q, err := quote.Get("FOOAASDADSAS")
	if err != nil {
		panic(err)
	}
	fmt.Printf("RegulardMarketPrice: %# +v", q.RegularMarketPrice)
}

This will panic:

$ go run .
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x50 pc=0x620b2e]

goroutine 1 [running]:
main.main()
        /home/pallotron/projects/example/ticker-quote.go:14 +0x2e
exit status 2
[Exit code 1 @ 10:12:01]

get.Quote should return an error in this case.

@pallotron
Copy link
Contributor Author

I will send a PR soon.

@pallotron
Copy link
Contributor Author

PR at #22

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

No branches or pull requests

1 participant