Minor bugfixes, avoid crashing unexpectedly
This commit is contained in:
		
							
								
								
									
										12
									
								
								ptgdp
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								ptgdp
									
									
									
									
									
								
							@@ -24,7 +24,7 @@ declare -A _config=(
 | 
				
			|||||||
	[ytdl_args]="--geo-bypass"
 | 
						[ytdl_args]="--geo-bypass"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
declare _optconfigfile="${XDG_CONFIG_HOME:-$HOME/.config}/${_name}.conf"
 | 
					declare _optconfigfile="${XDG_CONFIG_HOME:-$HOME/.config}/${_name}.conf"
 | 
				
			||||||
declare -i _optautoplay
 | 
					declare -i _optautoplay=0
 | 
				
			||||||
declare -i _opthelp
 | 
					declare -i _opthelp
 | 
				
			||||||
declare -i _optverbose
 | 
					declare -i _optverbose
 | 
				
			||||||
# Working variables
 | 
					# Working variables
 | 
				
			||||||
@@ -57,7 +57,7 @@ error() {
 | 
				
			|||||||
has() {
 | 
					has() {
 | 
				
			||||||
	# Parse out all arguments and try to find them in path
 | 
						# Parse out all arguments and try to find them in path
 | 
				
			||||||
	# If an argument cannot be found, set _return and fail
 | 
						# If an argument cannot be found, set _return and fail
 | 
				
			||||||
	for prog in $@; do
 | 
						for prog in "$@"; do
 | 
				
			||||||
		if ! command -v "$prog" > /dev/null 2>&1; then
 | 
							if ! command -v "$prog" > /dev/null 2>&1; then
 | 
				
			||||||
			_return="$prog"
 | 
								_return="$prog"
 | 
				
			||||||
			return 1
 | 
								return 1
 | 
				
			||||||
@@ -128,9 +128,11 @@ queuesong() {
 | 
				
			|||||||
	case $_returnstatus in
 | 
						case $_returnstatus in
 | 
				
			||||||
		cache)
 | 
							cache)
 | 
				
			||||||
			log "Using cached song \"$1\"" 1
 | 
								log "Using cached song \"$1\"" 1
 | 
				
			||||||
 | 
								log " $_return" 2
 | 
				
			||||||
			;;
 | 
								;;
 | 
				
			||||||
		*)
 | 
							*)
 | 
				
			||||||
			log "Downloaded song \"$1\"" 1
 | 
								log "Downloaded song \"$1\""
 | 
				
			||||||
 | 
								log " $_return" 2
 | 
				
			||||||
			;;
 | 
								;;
 | 
				
			||||||
	esac
 | 
						esac
 | 
				
			||||||
	_queue+=("$_return")
 | 
						_queue+=("$_return")
 | 
				
			||||||
@@ -205,7 +207,9 @@ backend-execqueue() {
 | 
				
			|||||||
	for song in "${_queue[@]}"; do
 | 
						for song in "${_queue[@]}"; do
 | 
				
			||||||
		backend-enqueue "$song"
 | 
							backend-enqueue "$song"
 | 
				
			||||||
	done
 | 
						done
 | 
				
			||||||
	[ "$_optautoplay" != "0" ] && backend-play
 | 
						if [ "$_optautoplay" != "0" ]; then
 | 
				
			||||||
 | 
							backend-play
 | 
				
			||||||
 | 
						fi
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Core program functions
 | 
					# Core program functions
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user