From 6a1bfe118321c3503b6acb0010fce91e51f17512 Mon Sep 17 00:00:00 2001 From: ksyasuda Date: Mon, 8 Nov 2021 00:55:36 -0800 Subject: [PATCH] add error checking to playlist mode --- aniwrapper | 3 +++ 1 file changed, 3 insertions(+) diff --git a/aniwrapper b/aniwrapper index a0a4280..23aab2d 100755 --- a/aniwrapper +++ b/aniwrapper @@ -60,6 +60,7 @@ elif [[ "$selection" == "4." ]]; then choice=$(printf "%s\n" "${options[@]}" | rofi -dmenu -sep '|' \ -config "$CFG_DIR/$CFG_FILE" -l 4 -i -p "Enter choice:") + [ -z "$choice" ] && seppuku "No choice selected" [ "$choice" == "5. Quit" ] && quit selection=$(printf "%s\n" "$choice" | awk '{ print $1 }') if [[ "$selection" == "1." ]]; then @@ -70,6 +71,7 @@ elif [[ "$selection" == "4." ]]; then choice=$(printf "%s\n" "${options[@]}" | rofi -dmenu -sep '|' \ -config "$CFG_DIR/$CFG_FILE" -l 4 -i -p "Enter choice:") + [ -z "$choice" ] && seppuku "No choice selected" [ "$choice" == "5. Quit" ] && quit selection=$(printf "%s\n" "$choice" | awk '{ print $1 }') if [[ "$selection" == "1." ]]; then @@ -81,6 +83,7 @@ elif [[ "$selection" == "4." ]]; then choice=$(find "$PLAYLIST_DIR" -type d | rofi -dmenu \ -config "$CFG_DIR/$CFG_FILE" -l 5 -i -p "Choose playlist:") + [ -z "$choice" ] && seppuku "No choice selected" [ -z "$choice" ] && run -P "$PLAYLIST_DIR/$choice" elif [[ "$selection" == "2." ]]; then