fix(DiskUtil): Fixed NPE crashes trying to get directory size

This commit is contained in:
Ahmad Ansori Palembani 2024-09-04 07:24:24 +07:00
parent 2debbc0a10
commit a2b47ab244
Signed by: null2264
GPG key ID: BA64F8B60AF3EFB6
2 changed files with 2 additions and 2 deletions

View file

@ -10,4 +10,4 @@
## Other ?? Technical stuff, what happened behind the scene ## Other ?? Technical stuff, what happened behind the scene
--> -->
## Fixes ## Fixes
- Fixed NPE crash on tablets - Fixed more NPE crashes

View file

@ -20,7 +20,7 @@ object DiskUtil {
fun getDirectorySize(f: File): Long { fun getDirectorySize(f: File): Long {
var size: Long = 0 var size: Long = 0
if (f.isDirectory) { if (f.isDirectory) {
for (file in f.listFiles()!!) { for (file in f.listFiles().orEmpty()) {
size += getDirectorySize(file) size += getDirectorySize(file)
} }
} else { } else {