From 80b6384d9471e26af1a10754c6f8ddbdb926845b Mon Sep 17 00:00:00 2001 From: Joachim Breitner Date: Tue, 6 Jan 2009 20:20:26 +0100 Subject: Fix possible head [] This seems to be a rare case, but I just got hit by it. darcs-hash:20090106192026-23c07-28a0137e2fed8c9923e6b7c49bc9407deaaccd5e --- XMonad/ManageHook.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'XMonad') diff --git a/XMonad/ManageHook.hs b/XMonad/ManageHook.hs index a0b7bb4..ac528c1 100644 --- a/XMonad/ManageHook.hs +++ b/XMonad/ManageHook.hs @@ -71,7 +71,8 @@ title = ask >>= \w -> liftX $ do getProp = (internAtom d "_NET_WM_NAME" False >>= getTextProperty d w) `catch` \_ -> getTextProperty d w wM_NAME - extract = fmap head . wcTextPropertyToTextList d + extract prop = do l <- wcTextPropertyToTextList d prop + return $ if null l then "" else head l io $ bracket getProp (xFree . tp_value) extract `catch` \_ -> return "" -- | Return the application name. -- cgit v1.2.3