Type-check recurse to prevent traceback, Fix #5741
Merge pull request #5764 from basepi/directory5741

Type-check recurse to prevent traceback, Fix #5741