Bug 1913357 - Make GetDiskSpaceAvailable return the right error in case of GetParent failing. r=xpcom-reviewers,nika

Differential Revision: https://phabricator.services.mozilla.com/D219277
This commit is contained in:
Jens Stutte 2024-08-17 11:30:59 +00:00
Родитель 5da0bbd4a3
Коммит 9864e8e2bc
1 изменённых файлов: 5 добавлений и 4 удалений

Просмотреть файл

@ -2774,11 +2774,12 @@ nsLocalFile::GetDiskSpaceAvailable(int64_t* aDiskSpaceAvailable) {
}
if (mFileInfo.type == PR_FILE_FILE) {
// Since GetDiskFreeSpaceExW works only on directories, use the parent.
// Since GetDiskFreeSpaceExW works only on directories, use the parent
// which must exist if we are a file.
nsCOMPtr<nsIFile> parent;
if (NS_SUCCEEDED(GetParent(getter_AddRefs(parent))) && parent) {
return parent->GetDiskSpaceAvailable(aDiskSpaceAvailable);
}
rv = GetParent(getter_AddRefs(parent));
NS_ENSURE_SUCCESS(rv, rv);
return parent->GetDiskSpaceAvailable(aDiskSpaceAvailable);
}
int64_t dummy = 0;