AppInfoList: make sure to dereference symlink before comparing

May fix #15633 (untested)

Change-Id: Id0c8f0617553d988e767bae46fe0ac8fd3e698e9
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2118
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
This commit is contained in:
Adrien Destugues 2020-01-16 21:39:20 +01:00 committed by Adrien Destugues
parent 3548a2eb71
commit 0e7d1f13e0

View File

@ -291,8 +291,14 @@ int32
AppInfoList::IndexOf(const entry_ref *ref) const AppInfoList::IndexOf(const entry_ref *ref) const
{ {
if (ref) { if (ref) {
// Dereference symlink if needed
BEntry entry(ref, true);
entry_ref realRef;
if (entry.GetRef(&realRef) != B_OK)
realRef = *ref;
for (int32 i = 0; RosterAppInfo *info = InfoAt(i); i++) { for (int32 i = 0; RosterAppInfo *info = InfoAt(i); i++) {
if (info->ref == *ref) if (info->ref == realRef)
return i; return i;
} }
} }