fix: empty records may fail (#26)

This commit is contained in:
mio 2023-05-12 12:46:21 +08:00
parent dcaad1d544
commit a2dcda6be0
2 changed files with 3 additions and 3 deletions

@ -1,6 +1,6 @@
{
"name": "star-rail-warp-export",
"version": "0.0.15",
"version": "0.0.16",
"main": "./dist/electron/main/main.js",
"author": "biuuu <https://github.com/biuuu>",
"license": "MIT",

@ -163,7 +163,7 @@ const getGachaLog = async ({ key, page, name, retryCount, url, endId }) => {
const text = i18n.log
try {
const res = await request(`${url}&gacha_type=${key}&page=${page}&size=${20}${endId ? '&end_id=' + endId : ''}`)
return res.data
return res?.data
} catch (e) {
if (retryCount) {
sendMsg(i18n.parse(text.fetch.retry, { name, page, count: 6 - retryCount }))
@ -196,7 +196,7 @@ const getGachaLogs = async ({ name, key }, queryString) => {
sendMsg(i18n.parse(text.fetch.current, { name, page }))
res = await getGachaLog({ key, page, name, url, endId, retryCount: 5 })
await sleep(0.3)
logs = res.list || []
logs = res?.list || []
if (!uid && logs.length) {
uid = logs[0].uid
}