diff --git a/src/kits/tracker/TrashWatcher.cpp b/src/kits/tracker/TrashWatcher.cpp index 2df752ee46..164fa4bc9e 100644 --- a/src/kits/tracker/TrashWatcher.cpp +++ b/src/kits/tracker/TrashWatcher.cpp @@ -213,11 +213,13 @@ BTrashWatcher::CheckTrashDirs() continue; BDirectory trashDir; - FSGetTrashDir(&trashDir, volume.Device()); - trashDir.Rewind(); - BEntry entry; - if (trashDir.GetNextEntry(&entry) == B_OK) - return true; + if (FSGetTrashDir(&trashDir, volume.Device()) == B_OK) { + trashDir.Rewind(); + // GetNextRef() is a bit faster than GetNextEntry() + entry_ref ref; + if (trashDir.GetNextRef(&ref) == B_OK) + return true; + } } return false;