mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-17 05:02:06 +00:00
fix(download): Crashes due to genius-lyrics feature
This commit is contained in:
@ -55,7 +55,7 @@ const sendError = (error: Error, source?: string) => {
|
|||||||
const cause = error.cause ? `\n\n${String(error.cause)}` : '';
|
const cause = error.cause ? `\n\n${String(error.cause)}` : '';
|
||||||
const message = `${error.toString()}${songNameMessage}${cause}`;
|
const message = `${error.toString()}${songNameMessage}${cause}`;
|
||||||
|
|
||||||
console.error(message);
|
console.error(message, error, error?.stack);
|
||||||
dialog.showMessageBox({
|
dialog.showMessageBox({
|
||||||
type: 'info',
|
type: 'info',
|
||||||
buttons: ['OK'],
|
buttons: ['OK'],
|
||||||
|
|||||||
@ -78,9 +78,9 @@ const getLyricsList = async (queryString: string): Promise<string | null> => {
|
|||||||
*/
|
*/
|
||||||
const info = await response.json() as GetGeniusLyric;
|
const info = await response.json() as GetGeniusLyric;
|
||||||
const url = info
|
const url = info
|
||||||
.response
|
?.response
|
||||||
.sections
|
?.sections
|
||||||
.find((section) => section.type === 'song')?.hits[0].result.url;
|
?.find((section) => section.type === 'song')?.hits[0]?.result?.url;
|
||||||
|
|
||||||
if (url) {
|
if (url) {
|
||||||
return await getLyrics(url);
|
return await getLyrics(url);
|
||||||
|
|||||||
Reference in New Issue
Block a user