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-11-25 06:20:03 +01:00
parent 863eb983f8
commit 4ba3c257e4
@@ -1182,13 +1182,15 @@ Volume::_RemovePackageContentRootNode(Package* package,
if (PackageDirectory* packageDirectory if (PackageDirectory* packageDirectory
= dynamic_cast<PackageDirectory*>(packageNode)) { = dynamic_cast<PackageDirectory*>(packageNode)) {
if (packageDirectory->FirstChild() != NULL) { if (packageDirectory->FirstChild() != NULL) {
directory = dynamic_cast<Directory*>( if (Directory* childDirectory = dynamic_cast<Directory*>(
directory->FindChild(packageNode->Name())); directory->FindChild(packageNode->Name()))) {
directory = childDirectory;
packageNode = packageDirectory->FirstChild(); packageNode = packageDirectory->FirstChild();
directory->WriteLock(); directory->WriteLock();
continue; continue;
} }
} }
}
// continue with the next available (ancestors's) sibling // continue with the next available (ancestors's) sibling
do { do {