Fix package removal with skipped directories

Volume::_RemovePackageContentRootNode(): Check whether a directory
corresponding to the package directory does actually exist. This might
not be the case when the package directory has been skipped due to
clashing with a shine-through directory. Would crash in this case.
This commit is contained in:
Ingo Weinhold 2011-07-21 00:35:35 +02:00
parent 863eb983f8
commit 4ba3c257e4

View File

@ -1182,11 +1182,13 @@ Volume::_RemovePackageContentRootNode(Package* package,
if (PackageDirectory* packageDirectory
= dynamic_cast<PackageDirectory*>(packageNode)) {
if (packageDirectory->FirstChild() != NULL) {
directory = dynamic_cast<Directory*>(
directory->FindChild(packageNode->Name()));
packageNode = packageDirectory->FirstChild();
directory->WriteLock();
continue;
if (Directory* childDirectory = dynamic_cast<Directory*>(
directory->FindChild(packageNode->Name()))) {
directory = childDirectory;
packageNode = packageDirectory->FirstChild();
directory->WriteLock();
continue;
}
}
}