Skip to content

Commit

Permalink
quote summary null check
Browse files Browse the repository at this point in the history
  • Loading branch information
mnsrulz committed Aug 28, 2024
1 parent 5740acb commit 5719d26
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/StockTicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ interface ITickerProps {

export const StockTickerView = (props: ITickerProps) => {
const oddata = useStockPrice(props.item);
if (oddata) {
if (oddata && oddata.quoteSummary) {
const { quoteSummary } = oddata;
const [price, change, changePercent] = (quoteSummary.hasPrePostMarketData && ['POST', 'POSTPOST', 'PRE'].includes(quoteSummary.marketState) && (quoteSummary.postMarketPrice || quoteSummary.preMarketPrice)) ?
[quoteSummary.postMarketPrice || quoteSummary.preMarketPrice, quoteSummary.postMarketChange || quoteSummary.preMarketChange, quoteSummary.postMarketChangePercent|| quoteSummary.preMarketChangePercent]
Expand Down

0 comments on commit 5719d26

Please sign in to comment.