Skip to content

Commit

Permalink
guard against not having the fonts directory exist
Browse files Browse the repository at this point in the history
  • Loading branch information
wordpressfan committed Jan 3, 2025
1 parent 0df11ca commit 1e4ab02
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion inc/Engine/Media/Fonts/Admin/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use RecursiveIteratorIterator;
use WP_Rocket\Admin\Options_Data;
use WP_Rocket\Engine\Common\Queue\AbstractASQueue;
use Exception;

class Data extends AbstractASQueue {
/**
Expand Down Expand Up @@ -72,7 +73,11 @@ public function collect_data() {
return;
}

$fonts = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $this->base_path . 'google-fonts/fonts/' ) );
try {
$fonts = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $this->base_path . 'google-fonts/fonts/' ) );
} catch ( Exception $exception ) {
return;
}

$allowed_extensions = [
'woff',
Expand Down

0 comments on commit 1e4ab02

Please sign in to comment.