If you don't have access to a subfolder inside the directory tree, Directory.GetFiles stops and throws the exception resulting in a null value in the receiving string[].
Here, see this answer https://stackoverflow.com/a/38959208/6310707
It manages the exception inside the loop and keep on working untill the entire folder is traversed.