Permalink
Browse files

Prevent empty index errors on file listing

  • Loading branch information...
kolber committed Jun 3, 2012
1 parent 0b8f395 commit ee44ec8a7dfc7668b8ecceea95512149a73c6ec3
Showing with 2 additions and 2 deletions.
  1. +2 −2 app/helpers.inc.php
View
@@ -84,7 +84,7 @@ static function list_files($dir, $regex, $folders_only = false) {
$files = array();
foreach(self::file_cache($dir) as $file) {
# if file matches regex, continue
- if(preg_match($regex, $file['file_name'])) {
+ if(isset($file['file_name']) && preg_match($regex, $file['file_name'])) {
# if $folders_only is true and the file is not a folder, skip it
if($folders_only && !$file['is_folder']) continue;
# otherwise, add file to results list
@@ -156,4 +156,4 @@ static function translate_named_entities($string) {
}
-?>
+?>

0 comments on commit ee44ec8

Please sign in to comment.