Name::Index(): Fix initialization order

Add the node listener directly after calling the base class Init().
Otherwise, on error, the we could try to remove the listener although it
wasn't added in the first place.
This commit is contained in:
Ingo Weinhold 2011-07-07 08:10:15 +02:00
parent 989addc209
commit 8373bcd169

View File

@ -148,13 +148,12 @@ NameIndex::Init(Volume* volume)
if (error != B_OK)
return error;
fVolume->AddNodeListener(this, NULL);
fEntries = new(std::nothrow) EntryTree;
if (fEntries == NULL)
return B_NO_MEMORY;
fVolume = volume;
fVolume->AddNodeListener(this, NULL);
return B_OK;
}