diff --git a/contrib/pg_upgrade/file.c b/contrib/pg_upgrade/file.c index c7b6f5cbfa..d3b0eaf2e2 100644 --- a/contrib/pg_upgrade/file.c +++ b/contrib/pg_upgrade/file.c @@ -296,7 +296,7 @@ pg_scandir_internal(const char *dirname, while ((direntry = readdir(dirdesc)) != NULL) { /* Invoke the selector function to see if the direntry matches */ - if ((*selector) (direntry)) + if (selector && (*selector) (direntry)) { count++;