}
#endif
/* no more files in directory, continue with processing parent */
- if ((parent = sk_BIO_pop(biosk)) == NULL) {
+ if (sk_BIO_num(biosk) < 1 || (parent = sk_BIO_pop(biosk)) == NULL) {
/* everything processed get out of the loop */
break;
} else {