Skip to content

Commit 8409162

Browse files
committed
fixing bug #222 - Appending a radio station with A in a playlist leads to a crash (when number stations is less than window height)
1 parent 7e41359 commit 8409162

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pyradio/radio.py

+4
Original file line numberDiff line numberDiff line change
@@ -8006,6 +8006,8 @@ def keypress(self, char):
80068006
self._cnf.number_of_stations = self.number_of_items
80078007
self.selection = self.number_of_items - 1
80088008
self.startPos = self.number_of_items - self.bodyMaxY
8009+
if self.startPos < 0:
8010+
self.startPos = 0
80098011
else:
80108012
if self.number_of_items == 0:
80118013
self._cnf.stations = [self._station_editor.new_station]
@@ -10452,6 +10454,8 @@ def _redisplay_stations_and_playlists(self):
1045210454
self.bodyWin.erase()
1045310455
else:
1045410456
for lineNum in range(self.bodyMaxY):
10457+
if self.startPos < 0:
10458+
self.startPos = 0
1045510459
i = lineNum + self.startPos
1045610460
if i < len(self.stations):
1045710461
if not self._cnf.browsing_station_service and \

0 commit comments

Comments
 (0)