Fix a couple bugs in the listdir implementation to avoid accessing elements in a zero-length vector.
Fix a couple bugs in the listdir implementation to avoid accessing
elements in a zero-length vector.

jcnelson/syndicate,iychoi/syndicate,jcnelson/syndicate,jcnelson/syndicate,iychoi/syndicate,iychoi/syndicate,iychoi/syndicate,jcnelson/syndicate,jcnelson/syndicate,iychoi/syndicate,jcnelson/syndicate,iychoi/syndicate,iychoi/syndicate,jcnelson/syndicate,jcnelson/syndicate,iychoi/syndicate