From 3856deccff27cdb3510622d65692d993215b5e1d Mon Sep 17 00:00:00 2001 From: GuardKenzie Date: Thu, 13 May 2021 01:09:10 +0000 Subject: [PATCH] Fixed an error where if player was resized quickly while trying to draw the playlist, the player would crash. --- bin/miniplayer | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/bin/miniplayer b/bin/miniplayer index 1adfb1d..cb14ec2 100755 --- a/bin/miniplayer +++ b/bin/miniplayer @@ -602,15 +602,20 @@ class Player: pair = curses.color_pair(2) | curses.A_REVERSE # Move and write text - self.playlist_win.move(line, 0) + try: + self.playlist_win.move(line, 0) - if playlist_item is not None: - self.playlist_win.addstr( - f"{playlist_item['artist']} - {playlist_item['title']}"[:self.playlist_window_width - 1], - pair - ) + if playlist_item is not None: + self.playlist_win.addstr( + f"{playlist_item['artist']} - {playlist_item['title']}"[:self.playlist_window_width - 1], + pair + ) + + self.playlist_win.clrtoeol() + + except curses.error: + return - self.playlist_win.clrtoeol() line += 1 self.playlist_win.refresh()