Skip to content

Commit 9641210

Browse files
committed
Improved _can_add_notif_actions() function.
Fixed masking return value. Disabled linter complaint for known version value format. Added return status check for notify-send command and early return. Signed-off-by: kilo52 <[email protected]>
1 parent f65500a commit 9641210

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

libinit.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,13 @@ function _show_notif_success_impl() {
712712
# 1 - If notification actions are not supported.
713713
#
714714
function _can_add_notif_actions() {
715-
local version=$(notify-send --version |cut -d ' ' -f2);
715+
local version;
716+
version=$(notify-send --version |cut -d ' ' -f2);
717+
if (( $? != 0 )); then
718+
return 1;
719+
fi
720+
# The format is known to be e.g.: '0.1.2'
721+
# shellcheck disable=SC2206
716722
version=(${version//./ });
717723
local major="${version[0]}";
718724
local minor="${version[1]}";

0 commit comments

Comments
 (0)