From bd30ed5d957b1871b694c780ffa4583863aff8a2 Mon Sep 17 00:00:00 2001 From: Osmany Montero Date: Wed, 26 Feb 2025 12:42:48 +0200 Subject: [PATCH] Ensure nil check before accessing file attributes Added a nil check for the file object to prevent potential runtime panics when accessing its attributes. This change ensures the program behaves reliably even if the file object is unexpectedly nil. --- correlation/rules/update.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/correlation/rules/update.go b/correlation/rules/update.go index 4e3c42a4f..170ccc415 100644 --- a/correlation/rules/update.go +++ b/correlation/rules/update.go @@ -24,7 +24,7 @@ func Update(updateReady chan bool) { } } - if f.IsDir() || f.Name() == "system" { + if f != nil && (f.IsDir() || f.Name() == "system") { rm := exec.Command("rm", "-R", cnf.RulesFolder+"system") err = rm.Run() if err != nil {