diff --git a/briar-core/src/org/briarproject/db/H2Database.java b/briar-core/src/org/briarproject/db/H2Database.java
index 664a2f68d4b2a992db970bd77f477f069bfca359..d7f064ddb26b7f1c18a372504e1c640728b128e1 100644
--- a/briar-core/src/org/briarproject/db/H2Database.java
+++ b/briar-core/src/org/briarproject/db/H2Database.java
@@ -70,11 +70,15 @@ class H2Database extends JdbcDatabase {
 	}
 
 	private long getDiskSpace(File f) {
-		long total = 0;
 		if(f.isDirectory()) {
+			long total = 0;
 			for(File child : f.listFiles()) total += getDiskSpace(child);
 			return total;
-		} else return f.length();
+		} else if(f.isFile()) {
+			return f.length();
+		} else {
+			return 0;
+		}
 	}
 
 	protected Connection createConnection() throws SQLException {