From 730c273eae055eaed743593b6ab7274e210bf4e3 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 11 Jan 2011 18:49:32 -0400 Subject: robustness fixes for empty or missing trust log --- UUID.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'UUID.hs') diff --git a/UUID.hs b/UUID.hs index 21f2b202e..67695d310 100644 --- a/UUID.hs +++ b/UUID.hs @@ -145,8 +145,12 @@ getTrusted :: Annex [UUID] getTrusted = do logfile <- trustLog s <- liftIO $ catch (readFile logfile) ignoreerror - return $ map (\l -> head $ words l) $ lines s + return $ parse s where + parse [] = [] + parse s = map firstword $ lines s + firstword [] = "" + firstword l = head $ words l ignoreerror _ = return "" {- Changes the list of trusted UUIDs. -} -- cgit v1.2.3