Skip to content

Commit

Permalink
Fix #3: Infinite loop if no project directory
Browse files Browse the repository at this point in the history
  • Loading branch information
pjeby committed Jul 28, 2020
1 parent 3d53ff8 commit 428bf9a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Project.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ static function parent_of($filename) {
$dir = dirname($filename);
if ( static::basename($filename) == 'index.md' ) {
if ( static::is_project($dir) ) return null;
$dir = dirname($dir);
$newdir = dirname($dir);
if ( $newdir === $dir ) return null;
$dir = $newdir;
}
$filename = $dir == '.' ? 'index.md' : "$dir/index.md";
} while ( ! file_exists($filename) || ! filesize($filename) );
Expand Down

0 comments on commit 428bf9a

Please sign in to comment.