From c5ba9a5c05a67ce31c3a68e324d80835f03d8eae Mon Sep 17 00:00:00 2001 From: Michael Aerni Date: Fri, 19 Jul 2024 12:51:36 -0400 Subject: [PATCH] =?UTF-8?q?Fix=20issue=20if=20method=20doesn=E2=80=99t=20e?= =?UTF-8?q?xist?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Sitemaps/SitemapRepository.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Sitemaps/SitemapRepository.php b/src/Sitemaps/SitemapRepository.php index e42dd52..724b103 100644 --- a/src/Sitemaps/SitemapRepository.php +++ b/src/Sitemaps/SitemapRepository.php @@ -46,6 +46,10 @@ public function find(string $id): ?Sitemap { $method = Str::before($id, '::').'Sitemaps'; + if (! method_exists($this, $method)) { + return null; + } + return $this->$method()->first(fn ($sitemap) => $id === $sitemap->id()); }