Skip to content

Commit 864d55b

Browse files
committed
fix #72: check if user entered a valid index on uninstall and exit otherwise
1 parent 08681bf commit 864d55b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

ubuntu-mainline-kernel.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,17 @@ Optional:
832832
read -rn1 index
833833
echo ""
834834

835+
if ! [[ $index == +([0-9]) ]]; then
836+
echo "No number entered, exiting"
837+
exit 0
838+
fi
839+
835840
uninstall_version=${LOCAL_VERSIONS[$index]}
841+
842+
if [ -z "$uninstall_version" ]; then
843+
echo "Version not found"
844+
exit 0
845+
fi
836846
elif containsElement "v${action_data[0]#v}" "${LOCAL_VERSIONS[@]}"; then
837847
uninstall_version="v"${action_data[0]#v}
838848
else

0 commit comments

Comments
 (0)