summaryrefslogtreecommitdiffhomepage
path: root/src/Plugins/Monitors
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2011-04-02 19:00:09 -0400
committerBen Boeckel <MathStuf@gmail.com>2011-04-02 19:00:09 -0400
commit3a38c21f5b68abb8faab46fb37e126ffa70e2989 (patch)
tree014263ab14137759c703a83f53a151783136ff06 /src/Plugins/Monitors
parenta6043e7831d941a03d098552bda9b824247c4715 (diff)
downloadxmobar-3a38c21f5b68abb8faab46fb37e126ffa70e2989.tar.gz
xmobar-3a38c21f5b68abb8faab46fb37e126ffa70e2989.tar.bz2
Use 0 if reading the file fails
Diffstat (limited to 'src/Plugins/Monitors')
-rw-r--r--src/Plugins/Monitors/Batt.hs2
1 files changed, 1 insertions, 1 deletions
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 =