зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
5da0bbd4a3
Коммит
9864e8e2bc
|
@ -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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче