From c5b852f95fddc659447d55bab0785a8452cfad8c Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Fri, 14 Jan 2011 14:06:08 +0000 Subject: [PATCH] Patch by Shade: If the volume does not return a valid capacity, don't crash with a division by zero error. Resolves #7103. Thanks! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40236 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/tracker/Pose.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/kits/tracker/Pose.cpp b/src/kits/tracker/Pose.cpp index e026c0da89..45230b410d 100644 --- a/src/kits/tracker/Pose.cpp +++ b/src/kits/tracker/Pose.cpp @@ -52,6 +52,9 @@ int32 CalcFreeSpace(BVolume *volume) { off_t capacity = volume->Capacity(); + if (capacity == 0) + return 100; + int32 percent = static_cast(volume->FreeBytes() / (capacity / 100)); // warn below 20 MB of free space (if this is less than 10% of free space)