From be615bf58a4f73ce3cb5d50b9c4d7e0bf3bc0a5d Mon Sep 17 00:00:00 2001 From: Alan Dixon Date: Wed, 21 Oct 2020 20:24:41 +0000 Subject: [PATCH] put asset rendering call into a try/catch --- Civi/Core/AssetBuilder.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Civi/Core/AssetBuilder.php b/Civi/Core/AssetBuilder.php index 155c32c779..27fb1490e5 100644 --- a/Civi/Core/AssetBuilder.php +++ b/Civi/Core/AssetBuilder.php @@ -188,10 +188,14 @@ class AssetBuilder { if (!file_exists($this->getCachePath())) { mkdir($this->getCachePath()); } - - $rendered = $this->render($name, $params); - file_put_contents($this->getCachePath($fileName), $rendered['content']); - return $fileName; + try { + $rendered = $this->render($name, $params); + file_put_contents($this->getCachePath($fileName), $rendered['content']); + return $fileName; + } + catch (UnknownAssetException $e) { + // ignore possibly missing asset + } } return $fileName; } -- 2.25.1