diff --git a/safe-svg.php b/safe-svg.php index 399fc3a1..440ca98e 100644 --- a/safe-svg.php +++ b/safe-svg.php @@ -597,6 +597,11 @@ protected function svg_dimensions( $attachment_id ) { } elseif ( $svg ) { $svg = @simplexml_load_file( $svg ); // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged + // Ensure the svg could be loaded. + if ( ! $svg ) { + return false; + } + $attributes = $svg->attributes(); if ( isset( $attributes->viewBox ) ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase