diff --git a/modules/security/malware-scanner.sh b/modules/security/malware-scanner.sh index 25d63bf..2fbe335 100755 --- a/modules/security/malware-scanner.sh +++ b/modules/security/malware-scanner.sh @@ -2227,20 +2227,33 @@ delete_standalone_sessions() { # Main scan menu show_scan_menu() { + # Ensure print_banner is available before calling it + if ! declare -f "print_banner" &>/dev/null; then + echo "ERROR: print_banner function not found" >&2 + return 1 + fi + # Build reference database once for the entire menu session if command -v build_reference_database &>/dev/null; then - echo "Building system reference database..." build_reference_database 2>/dev/null || true clear fi while true; do - print_banner "Malware Scanner" + # Call print_banner - MUST succeed + print_banner "Malware Scanner" || { + echo "ERROR: print_banner failed" >&2 + return 1 + } echo "Available Scanners:" - for scanner in "${available_scanners[@]}"; do - echo " • ${scanner^}" - done + if [ ${#available_scanners[@]} -eq 0 ]; then + echo " (None currently installed)" + else + for scanner in "${available_scanners[@]}"; do + echo " • ${scanner^}" + done + fi echo "" echo -e "${CYAN}Create New Scan:${NC}" @@ -2590,6 +2603,13 @@ main() { # Don't exit if none found - menu option 9 allows installation detect_scanners || true + # Verify show_scan_menu exists and is callable + if ! declare -f "show_scan_menu" &>/dev/null; then + echo "ERROR: show_scan_menu function not found" >&2 + return 1 + fi + + # Call the menu function show_scan_menu }