fixed removal of directory when removing a friend

This commit is contained in:
csoler 2016-09-28 23:02:24 +02:00
parent c2761659e9
commit e185bcdab4

View File

@ -445,9 +445,13 @@ void p3FileDatabase::cleanup()
// now, in order to avoid empty seats, just move the last one here, and update indexes // now, in order to avoid empty seats, just move the last one here, and update indexes
while(i < mRemoteDirectories.size() && mRemoteDirectories[i] == NULL)
{
mRemoteDirectories[i] = mRemoteDirectories.back(); mRemoteDirectories[i] = mRemoteDirectories.back();
mRemoteDirectories.pop_back(); mRemoteDirectories.pop_back();
}
if(i < mRemoteDirectories.size() && mRemoteDirectories[i] != NULL) // this test is needed in the case we have deleted the last element
mFriendIndexMap[mRemoteDirectories[i]->peerId()] = i; mFriendIndexMap[mRemoteDirectories[i]->peerId()] = i;
mUpdateFlags |= P3FILELISTS_UPDATE_FLAG_REMOTE_DIRS_CHANGED ; mUpdateFlags |= P3FILELISTS_UPDATE_FLAG_REMOTE_DIRS_CHANGED ;