Skip to content

Commit

Permalink
fix: 修复没有音乐时白屏的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
maotoumao committed Dec 24, 2024
1 parent 56f9e44 commit 9dd2b70
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export default function MusicInfo() {
<MusicFavorite musicItem={musicItem} size={22}></MusicFavorite>
<MusicDownloaded musicItem={musicItem} size={22}></MusicDownloaded>
<div role="button"
data-disabled={!PluginManager.isSupportFeatureMethod(musicItem.platform, "getMusicComments")}
data-disabled={!PluginManager.isSupportFeatureMethod(musicItem?.platform, "getMusicComments")}
onClick={() => {
showPanel("MusicComment", {
musicItem: musicItem,
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/components/MusicDownloaded/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ function MusicDownloaded(props: IMusicDownloadedProps) {
}
onClick={() => {
if (
downloadState === DownloadState.NONE ||
downloadState === DownloadState.ERROR
musicItem && (downloadState === DownloadState.NONE ||
downloadState === DownloadState.ERROR)
) {
Downloader.startDownload(musicItem);
}
Expand Down
3 changes: 3 additions & 0 deletions src/shared/plugin-manager/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ function getPluginByPlatform(platform: string) {
}

function isSupportFeatureMethod(platform: string, featureMethod: keyof IPlugin.IPluginInstanceMethods) {
if (!platform) {
return false;
}
return delegatePluginsStore.getValue().find((item) => item.platform === platform)?.supportedMethod?.includes?.(featureMethod) ?? false;
}

Expand Down

0 comments on commit 9dd2b70

Please sign in to comment.