[haiku-commits] r40236 - haiku/trunk/src/kits/tracker

  • From: anevilyak@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 14 Jan 2011 15:06:08 +0100 (CET)

Author: anevilyak
Date: 2011-01-14 15:06:08 +0100 (Fri, 14 Jan 2011)
New Revision: 40236
Changeset: http://dev.haiku-os.org/changeset/40236
Ticket: http://dev.haiku-os.org/ticket/7103

Modified:
   haiku/trunk/src/kits/tracker/Pose.cpp
Log:
Patch by Shade: If the volume does not return a valid capacity, don't crash 
with a division by zero error. Resolves #7103. Thanks!



Modified: haiku/trunk/src/kits/tracker/Pose.cpp
===================================================================
--- haiku/trunk/src/kits/tracker/Pose.cpp       2011-01-14 01:02:28 UTC (rev 
40235)
+++ haiku/trunk/src/kits/tracker/Pose.cpp       2011-01-14 14:06:08 UTC (rev 
40236)
@@ -52,6 +52,9 @@
 CalcFreeSpace(BVolume *volume)
 {
        off_t capacity = volume->Capacity();
+       if (capacity == 0)
+               return 100;
+
        int32 percent = static_cast<int32>(volume->FreeBytes() / (capacity / 
100));
 
        // warn below 20 MB of free space (if this is less than 10% of free 
space)


Other related posts:

  • » [haiku-commits] r40236 - haiku/trunk/src/kits/tracker - anevilyak