Browse Source

Fixed index error.

KrisVos130 9 năm trước cách đây
mục cha
commit
222bb6df66
1 tập tin đã thay đổi với 3 bổ sung0 xóa
  1. 3 0
      app/server/server.js

+ 3 - 0
app/server/server.js

@@ -72,6 +72,9 @@ function Station(type) {
         songs = playlist.songs;
     }
     var currentSong = playlist.lastSong;
+    if (currentSong < (songs.length - 1)) {
+        currentSong++;
+    } else currentSong = 0;
     var currentTitle = songs[currentSong].title;
 
     Rooms.update({type: type}, {$set: {currentSong: {song: songs[currentSong], started: startedAt}}});