Fix crash when opening properties' dialog from search on three or more selected files in distinct directories. Fixes #1585 MR !618 (cherry picked from commit b7393e15)