fix crash
This commit is contained in:
@@ -23,14 +23,17 @@ export const getfuzzworkPrices: PriceGetter = async types => {
|
||||
return (await Promise.all(batches))
|
||||
.flatMap(b => Object.entries(b.data))
|
||||
.map(entry => {
|
||||
const id = parseInt(entry[0]);
|
||||
const id = doParseInt(entry[0]);
|
||||
const prices = entry[1] as any;
|
||||
|
||||
return {
|
||||
type: types.find(t => t.id === id) as MarketType,
|
||||
buy: parseFloat(prices.buy.max),
|
||||
sell: parseFloat(prices.sell.min),
|
||||
orderCount: parseInt(prices.buy.order_count) + parseInt(prices.sell.order_count)
|
||||
buy: doParseFloat(prices?.buy?.max),
|
||||
sell: doParseFloat(prices?.sell?.min),
|
||||
orderCount: doParseInt(prices?.buy?.order_count) + doParseInt(prices?.sell?.order_count)
|
||||
}
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
const doParseInt = (s?: string) => s ? parseInt(s) : 0;
|
||||
const doParseFloat = (s?: string) => s ? parseFloat(s) : 0;
|
||||
|
||||
Reference in New Issue
Block a user