From a002121921c5c68956b3785c3d2a1f62f7f4752b Mon Sep 17 00:00:00 2001 From: Andrea Rossato Date: Tue, 24 Jul 2007 11:27:01 +0200 Subject: Monitors.Common: parseString will not produce exceptions anymore An empty string will be returned instead. darcs-hash:20070724092701-d6583-aa7c76ce3c38f93415c05b5afd86618b4aad6f71.gz --- Plugins/Monitors/Common.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Plugins') diff --git a/Plugins/Monitors/Common.hs b/Plugins/Monitors/Common.hs index d2ae8c3..53374d2 100644 --- a/Plugins/Monitors/Common.hs +++ b/Plugins/Monitors/Common.hs @@ -253,7 +253,9 @@ floatToPercent n = stringParser :: Pos -> B.ByteString -> String stringParser (x,y) = - flip (!!) x . map B.unpack . B.words . flip (!!) y . B.lines + tk x . words . tk y . lines . B.unpack + where tk i l | length l >= i = flip (!!) i $ l + | otherwise = [] setColor :: String -> Selector (Maybe String) -> Monitor String setColor str s = -- cgit v1.2.3