Fix NULL check issues (HIGH priority)

Added validation checks for potentially empty variables before use
to prevent errors and unsafe operations.

WordPress Cron Manager (5 fixes):
- Added site_path validation after dirname operations
- Prevents using empty paths in cd commands and file operations
- Pattern: Check [ -z "$site_path" ] before use

Bot Analyzer:
- Quoted TEMP_DIR in trap command for safety

Hardware Health Check:
- Quoted MESSAGES_CACHE in trap command for safety

Note: 5 issues flagged in toolkit-qa-check.sh were false positives
(echo statements demonstrating bad patterns, not actual code issues)
This commit is contained in:
cschantz
2026-01-02 17:32:15 -05:00
parent 45e115ec4b
commit 5a2d51d496
3 changed files with 14 additions and 2 deletions
+1 -1
View File
@@ -1700,7 +1700,7 @@ main() {
touch "$MESSAGES_CACHE"
fi
# Cleanup cache on exit
trap "rm -f $MESSAGES_CACHE" EXIT
trap "rm -f \"$MESSAGES_CACHE\"" EXIT
# Run diagnostics with progress indicators
echo -e "${YELLOW}[1/11]${NC} Analyzing disk SMART status and predictive failure indicators..."