From 3e9e1cb9d300e13109206496d825351c4f41cc1c Mon Sep 17 00:00:00 2001 From: Sibi Prabakaran Date: Sun, 10 May 2020 19:43:56 +0530 Subject: Fix crashes/busy looping happening via index Right now, with the `StdinReader` plugin enabled - you can crash/cause busy looping of xmobar if the following html file is opened: ``` hello <fn=1>string</fn> ``` More details about this bug is here: https://github.com/jaor/xmobar/issues/442#issuecomment-625706001 This MR also fixes another bug which produces a crash in xmobar if you pass non integer items between fn: --- src/Xmobar/App/Main.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/Xmobar/App/Main.hs') diff --git a/src/Xmobar/App/Main.hs b/src/Xmobar/App/Main.hs index e0b0329..f173e12 100644 --- a/src/Xmobar/App/Main.hs +++ b/src/Xmobar/App/Main.hs @@ -29,6 +29,7 @@ import System.Environment (getArgs) import System.FilePath import System.FilePath.Posix (takeBaseName, takeDirectory) import Text.Parsec.Error (ParseError) +import Data.List.NonEmpty (NonEmpty(..)) import Graphics.X11.Xlib @@ -63,7 +64,7 @@ xmobar conf = withDeferSignals $ do let ic = Map.empty to = textOffset conf ts = textOffsets conf ++ replicate (length fl) (-1) - startLoop (XConf d r w (fs:fl) (to:ts) ic conf) sig refLock vars + startLoop (XConf d r w (fs :| fl) (to:ts) ic conf) sig refLock vars configFromArgs :: Config -> IO Config configFromArgs cfg = getArgs >>= getOpts >>= doOpts cfg . fst -- cgit v1.2.3