From 3a38c21f5b68abb8faab46fb37e126ffa70e2989 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Sat, 2 Apr 2011 19:00:09 -0400 Subject: Use 0 if reading the file fails --- src/Plugins/Monitors/Batt.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Plugins/Monitors/Batt.hs b/src/Plugins/Monitors/Batt.hs index a472045..c276e6b 100644 --- a/src/Plugins/Monitors/Batt.hs +++ b/src/Plugins/Monitors/Batt.hs @@ -124,7 +124,7 @@ readBattery files = (3600 * b / 1000000) -- wattseconds (c / 1000000) -- volts (if c > 0 then (d / c) else -1) -- amperes - where grab = fmap (read . B.unpack) . B.readFile + where grab f = catch (fmap (read . B.unpack) $ B.readFile f) (\_ -> return 0) readBatteries :: BattOpts -> [Files] -> IO Result readBatteries opts bfs = -- cgit v1.2.3