fix(download): Crashes due to genius-lyrics feature

This commit is contained in:
JellyBrick
2023-09-11 15:58:44 +09:00
parent 1d6f1d2216
commit 9739dbe27f
2 changed files with 4 additions and 4 deletions

View File

@ -55,7 +55,7 @@ const sendError = (error: Error, source?: string) => {
const cause = error.cause ? `\n\n${String(error.cause)}` : '';
const message = `${error.toString()}${songNameMessage}${cause}`;
console.error(message);
console.error(message, error, error?.stack);
dialog.showMessageBox({
type: 'info',
buttons: ['OK'],

View File

@ -78,9 +78,9 @@ const getLyricsList = async (queryString: string): Promise<string | null> => {
*/
const info = await response.json() as GetGeniusLyric;
const url = info
.response
.sections
.find((section) => section.type === 'song')?.hits[0].result.url;
?.response
?.sections
?.find((section) => section.type === 'song')?.hits[0]?.result?.url;
if (url) {
return await getLyrics(url);