Bugfix for ERRAI-809

Added Null check for the return value of listFiles().