Browse Source

fix: remove/add song to playlist would sometimes throw an error if not an official song

Kristian Vos 1 year ago
parent
commit
2fc3ebbc11
1 changed files with 2 additions and 2 deletions
  1. 2 2
      backend/logic/actions/playlists.js

+ 2 - 2
backend/logic/actions/playlists.js

@@ -1243,7 +1243,7 @@ export default {
 					const { _id, youtubeId, title, artists, thumbnail } = newSong;
 					const { likes, dislikes } = ratings;
 
-					SongsModule.runJob("UPDATE_SONG", { songId: _id });
+					if (_id) SongsModule.runJob("UPDATE_SONG", { songId: _id });
 
 					if (playlist.type === "user-liked") {
 						CacheModule.runJob("PUB", {
@@ -1903,7 +1903,7 @@ export default {
 					if (ratings && (playlist.type === "user-liked" || playlist.type === "user-disliked")) {
 						const { likes, dislikes } = ratings;
 
-						SongsModule.runJob("UPDATE_SONG", { songId: _id });
+						if (_id) SongsModule.runJob("UPDATE_SONG", { songId: _id });
 
 						if (playlist.type === "user-liked") {
 							CacheModule.runJob("PUB", {