-
Notifications
You must be signed in to change notification settings - Fork 219
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
Checking for null return? #64
Comments
Hi, I can't really tell from this piece of code what could be the problem. |
Hey man, Thanks for responding, first of all, this is a great api. I'm just inputting random things in the sticker EditText to see what happens. This is what I get:
|
I think what he's asking is how can we validate if the stock exist or not |
That's indeed a bit difficult. Since Yahoo Finance is not returning an error if a stock doesn't exist, this library is just creating a new Stock object like it would for any successful request. Not sure what would be the best way for the library to behave in this situation. Throw an exception when the name for the requested stock is empty? On top of that, from the stack trace it's clear that there's actually a problem in the |
Thank you both for your input. Name check makes sense, although I am confused as to how it got to getChange() - Shouldn't getClose() be called first? In my current set up, the user adds their stocks one by one. For a List, I suggest iterating through it, and returning the Stocks one by one, using a name check (?) on them iteratively to make sure they exist. |
Solved issue with condition stock.getName()==null| . On another note, HistoricalQuotes cannot be withdrawn for bitcoin data or BTCUSD. After investigating this further, I've come to the conclusion that this is a Yahoo server side issue. |
I've added some checks to prevent NullPointerExceptions in the StockQuote. |
Hi,
Great API, but I was having some issues checking for null returns if one types in the wrong ticker code.
My asyncTask code is shown below : despite checking for null at PostExecute I am still getting a NullpointerException, meaning that it passed the null check. Am I not checking in the correct manner?
`
`
The text was updated successfully, but these errors were encountered: