summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2010-12-02 21:26:37 -0400
committerGravatar Joey Hess <joey@kitenet.net>2010-12-02 21:26:37 -0400
commit71d60eb87a492a9561f7142cc897ff5961c21e25 (patch)
tree1baa08aa85fc1734e54f2b291e0beaf407582acf
parent83a87a522903e18a16ae19e1b741ab4e1f2b95a6 (diff)
robustness fix
don't crash if an object directory does not contain a file
-rw-r--r--Core.hs8
1 files changed, 5 insertions, 3 deletions
diff --git a/Core.hs b/Core.hs
index 8cdb063c7..e3702044e 100644
--- a/Core.hs
+++ b/Core.hs
@@ -190,9 +190,11 @@ getKeysPresent' dir = do
return $ map fileKey files
where
present d = do
- s <- getFileStatus $ dir ++ "/" ++ d ++ "/"
- ++ takeFileName d
- return $ isRegularFile s
+ result <- try $
+ getFileStatus $ dir ++ "/" ++ d ++ "/" ++ takeFileName d
+ case result of
+ Right s -> return $ isRegularFile s
+ Left _ -> return False
{- List of keys referenced by symlinks in the git repo. -}
getKeysReferenced :: Annex [Key]