Skip to content

Commit

Permalink
Add null check
Browse files Browse the repository at this point in the history
  • Loading branch information
relliv committed Oct 22, 2023
1 parent 449f19b commit a3adc74
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/Supports/Domain.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,14 @@ public static function getDomainInfo($url)
$favicon = ShortUrlFavicon::where('domain', $data['host'])->first();

if (!$favicon) {
$favicon = ShortUrlFavicon::create([
'domain' => $data['host'],
'favicon' => (new Favicon())->getFavicon($data['host']),
]);
$crawledFavicon = (new Favicon())->getFavicon($data['host']);

if ($crawledFavicon) {
$favicon = ShortUrlFavicon::create([
'domain' => $data['host'],
'favicon' => $crawledFavicon,
]);
}
}

$data['favicon_id'] = $favicon->id ?? null;
Expand Down

0 comments on commit a3adc74

Please sign in to comment.