Forráskód Böngészése

Fix index out of range

Svilen Markov 4 hónapja
szülő
commit
bb9cb03c8a
1 módosított fájl, 2 hozzáadás és 1 törlés
  1. 2 1
      internal/glance/widget-videos.go

+ 2 - 1
internal/glance/widget-videos.go

@@ -52,10 +52,11 @@ func (widget *videosWidget) initialize() error {
 	// playlists are separate things rather than specifying a list of channels and some of
 	// them awkwardly have a "playlist:" prefix
 	if len(widget.Playlists) > 0 {
+		initialLen := len(widget.Channels)
 		widget.Channels = append(widget.Channels, make([]string, len(widget.Playlists))...)
 
 		for i := range widget.Playlists {
-			widget.Channels[len(widget.Channels)-1+i] = "playlist:" + widget.Playlists[i]
+			widget.Channels[initialLen+i] = "playlist:" + widget.Playlists[i]
 		}
 	}