Procházet zdrojové kódy

Fixed issue with stations.

KrisVos130 před 9 roky
rodič
revize
0e27c16d20
1 změnil soubory, kde provedl 7 přidání a 1 odebrání
  1. 7 1
      app/server/server.js

+ 7 - 1
app/server/server.js

@@ -169,9 +169,15 @@ function Station(type) {
     } else currentSong = 0;
     } else currentSong = 0;
     var currentMid = songs[currentSong];
     var currentMid = songs[currentSong];
 
 
+    var song = Songs.findOne({mid: songs[currentSong]});
+    if (song === undefined) {
+        Playlists.remove({}, {$pull: {songs: currentMid}});
+        song = default_song;
+    }
+
     var res = Rooms.update({type: type}, {
     var res = Rooms.update({type: type}, {
         $set: {
         $set: {
-            currentSong: {song: Songs.findOne({mid: songs[currentSong]}), started: startedAt},
+            currentSong: {song: song, started: startedAt},
             users: 0
             users: 0
         }
         }
     });
     });