attempt at fixing a bug that can cause a crash in p3filelists.cc

This commit is contained in:
cyril soler 2017-02-17 09:17:22 +01:00
parent c61ccda431
commit cda3c744af

View File

@ -896,9 +896,9 @@ uint32_t p3FileDatabase::getType(void *ref) const
if(e == 0)
return DIR_TYPE_PERSON ;
if(fi == 0)
if(fi == 0 && mLocalSharedDirs != NULL)
return mLocalSharedDirs->getEntryType(e) ;
else if(mRemoteDirectories[fi-1]!=NULL)
else if(fi-1 < mRemoteDirectories.size() && mRemoteDirectories[fi-1]!=NULL)
return mRemoteDirectories[fi-1]->getEntryType(e) ;
else
return DIR_TYPE_ROOT ;// some failure case. Should not happen