Skip to content

Commit c9fa1ba

Browse files
committed
commit
1 parent a40218f commit c9fa1ba

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

app/base/controllers/Admin/Login.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,12 @@ public function getBaseTemplateData(): array
140140
if ($this->getCache()->has($picsumKey)) {
141141
$picsumIds = $this->getCache()->get($picsumKey);
142142
} else {
143-
$picsumIds = json_decode($this->getUtils()->requestUrl('https://picsum.photos/v2/list?page'.rand(0, 10).'&limit=100'), true);
144-
$this->getCache()->set($picsumKey, $picsumIds, 3600);
143+
try {
144+
$picsumIds = json_decode($this->getUtils()->requestUrl('https://picsum.photos/v2/list?page'.rand(0, 10).'&limit=100'), true);
145+
$this->getCache()->set($picsumKey, $picsumIds, 3600);
146+
} catch (Exception $e) {
147+
$picsumIds = [];
148+
}
145149
}
146150

147151
$image = current(array_slice($picsumIds, rand(0, count($picsumIds)), 1));

0 commit comments

Comments
 (0)