From fefe313d515affcdd9bd7856a5442bc478b86848 Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Wed, 21 Aug 2024 10:48:22 +0200 Subject: [PATCH] modulecmd: use of unset variable fixed --- Pmodules/modulecmd.bash.in | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Pmodules/modulecmd.bash.in b/Pmodules/modulecmd.bash.in index 9c61f99..47419b7 100644 --- a/Pmodules/modulecmd.bash.in +++ b/Pmodules/modulecmd.bash.in @@ -1993,13 +1993,15 @@ subcommand_unuse() { "${arg}" fi - local var="PMODULES_LOADED_${arg^^}" - if [[ -n "${!var}" ]]; then - std::die 3 "%s %s: %s -- %s" \ - "${CMD}" "${SubCommand}" \ - "cannot remove group due to loaded modules" \ - "${arg}" - fi + if [[ -v PMODULES_LOADED_${arg^^} ]]; then + local var="PMODULES_LOADED_${arg^^}" + if [[ -n "${!var}" ]]; then + std::die 3 "%s %s: %s -- %s" \ + "${CMD}" "${SubCommand}" \ + "cannot remove group due to loaded modules" \ + "${arg}" + fi + fi std::remove_path UsedGroups "${arg}" local overlay for overlay in "${UsedOverlays[@]}"; do