summaryrefslogtreecommitdiff
path: root/Annex
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-02-23 14:39:56 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-02-23 14:39:56 -0400
commit462217110db8f07463b28bb77dcbdb7c773eff49 (patch)
treef2c3f31f2cae2f9ee66d63c5e5b6140c2b6f5f55 /Annex
parent23ed99f1874978fa415a55110b3291ff1381ae66 (diff)
Avoid crashing when built with MagicMime support, but when the magic database cannot be loaded.
Diffstat (limited to 'Annex')
-rw-r--r--Annex/FileMatcher.hs6
1 files changed, 4 insertions, 2 deletions
diff --git a/Annex/FileMatcher.hs b/Annex/FileMatcher.hs
index e97b80c82..5167a5e02 100644
--- a/Annex/FileMatcher.hs
+++ b/Annex/FileMatcher.hs
@@ -129,8 +129,10 @@ preferredContentParser matchstandard matchgroupwanted getgroupmap configmap mu e
mkLargeFilesParser :: Annex (String -> [ParseResult])
mkLargeFilesParser = do
#ifdef WITH_MAGICMIME
- magicmime <- liftIO $ magicOpen [MagicMimeType]
- liftIO $ magicLoadDefault magicmime
+ magicmime <- liftIO $ catchMaybeIO $ do
+ m <- magicOpen [MagicMimeType]
+ liftIO $ magicLoadDefault m
+ return m
#endif
let parse = parseToken $ commonTokens
#ifdef WITH_MAGICMIME