Skip to content

Commit

Permalink
Merge pull request #168 from mihaimaruseac/patch-1
Browse files Browse the repository at this point in the history
No more `error: division by zero` when trying to print or operate on empty storable vectors
  • Loading branch information
dolio authored May 3, 2017
2 parents 42d5337 + 3e2bd9f commit a55d0c2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Data/Vector/Storable/Mutable.hs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ instance Storable a => G.MVector MVector a where
fp <- mallocVector n
return $ MVector n fp
where
size = sizeOf (undefined :: a)
size = sizeOf (undefined :: a) `max` 1
mx = maxBound `quot` size :: Int

{-# INLINE basicInitialize #-}
Expand Down

0 comments on commit a55d0c2

Please sign in to comment.