aboutsummaryrefslogtreecommitdiff
path: root/Assistant/Drop.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-06-24 12:44:51 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-06-24 12:44:51 -0400
commit3e5a73062097468c89f59835991654540a5addbf (patch)
tree3dd8640e0017c649d9df7f4863e8d069681f4a85 /Assistant/Drop.hs
parent4ad212dc25c2d9376de238b2f97031e54b7a2cfe (diff)
fix crash in drop scan when there are no associated files
maximum is partial, so need to ensure the list is not empty. This lack of associated files would most likely be a problem -- and fsck fixes it. It could also occur legitimately due to a race.
Diffstat (limited to 'Assistant/Drop.hs')
-rw-r--r--Assistant/Drop.hs6
1 files changed, 5 insertions, 1 deletions
diff --git a/Assistant/Drop.hs b/Assistant/Drop.hs
index 4e81c284a..1fc2f75d9 100644
--- a/Assistant/Drop.hs
+++ b/Assistant/Drop.hs
@@ -45,7 +45,11 @@ handleDropsFrom :: [UUID] -> [Remote] -> Reason -> Bool -> Key -> AssociatedFile
handleDropsFrom _ _ _ _ _ Nothing _ = noop
handleDropsFrom locs rs reason fromhere key (Just afile) knownpresentremote = do
fs <- liftAnnex $ ifM isDirect
- ( associatedFilesRelative key
+ ( do
+ l <- associatedFilesRelative key
+ if null l
+ then return [afile]
+ else return l
, return [afile]
)
n <- getcopies fs