fix crash for non-existent workspace directories
authorAndreas Frisch <andreas.frisch@multimedia-labs.de>
Fri, 4 Jul 2008 12:37:01 +0000 (12:37 +0000)
committerAndreas Frisch <andreas.frisch@multimedia-labs.de>
Fri, 4 Jul 2008 12:37:01 +0000 (12:37 +0000)
lib/python/Components/Task.py

index 07b9d3f..167de21 100644 (file)
@@ -303,13 +303,13 @@ class WorkspaceExistsPrecondition(Condition):
 class DiskspacePrecondition(Condition):
        def __init__(self, diskspace_required):
                self.diskspace_required = diskspace_required
-               self.diskspace_available = None
+               self.diskspace_available = 0
 
        def check(self, task):
                import os
                try:
                        s = os.statvfs(task.job.workspace)
-                       self.diskspace_available = s.f_bsize * s.f_bavail 
+                       self.diskspace_available = s.f_bsize * s.f_bavail
                        return self.diskspace_available >= self.diskspace_required
                except OSError:
                        return False