From 6ac13d70d701bc6f0e8a24ef4fa67e501403fe81 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Sat, 11 Dec 2010 14:18:49 -0500 Subject: Don't hard code the number of values Make an infinite list of empty strings so that if something is asked for and cannot be provided, index errors don't occur. --- Plugins/Monitors/Cpu.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Plugins/Monitors/Cpu.hs') diff --git a/Plugins/Monitors/Cpu.hs b/Plugins/Monitors/Cpu.hs index 71e8ac3..fb5e9e2 100644 --- a/Plugins/Monitors/Cpu.hs +++ b/Plugins/Monitors/Cpu.hs @@ -39,7 +39,7 @@ parseCPU = return percent formatCpu :: [Float] -> Monitor [String] -formatCpu [] = return [""] +formatCpu [] = return $ repeat "" formatCpu xs = do let t = foldr (+) 0 $ take 3 xs b <- showPercentBar (100 * t) t -- cgit v1.2.3