diff --git a/lib/private/Template/IconsCacher.php b/lib/private/Template/IconsCacher.php
index 1020cd24dcded216982a3cdfc60c761de811e0b4..aab3295405d4d9c089afee9b76b2c209ad1287ac 100644
--- a/lib/private/Template/IconsCacher.php
+++ b/lib/private/Template/IconsCacher.php
@@ -120,8 +120,8 @@ class IconsCacher {
 			$list .= "--$icon: url('$url');";
 			list($location,$color) = $this->parseUrl($url);
 			$svg = false;
-			if ($location !== '') {
-				$svg = file_get_contents($location);
+			if ($location !== '' && \file_exists($location)) {
+				$svg = \file_get_contents($location);
 			}
 			if ($svg === false) {
 				$this->logger->debug('Failed to get icon file ' . $location);