浏览代码

Update MediaService, return empty array if cantt find status

Daniel Supernault 3 年之前
父节点
当前提交
c2910e5d42
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      app/Services/MediaService.php

+ 3 - 0
app/Services/MediaService.php

@@ -19,6 +19,9 @@ class MediaService
 	public static function get($statusId)
 	{
 		$status = Status::find($statusId);
+		if(!$status) {
+			return [];
+		}
 		$ttl = $status->created_at->lt(now()->subMinutes(30)) ? 129600 : 30;
 		return Cache::remember(self::CACHE_KEY.$statusId, $ttl, function() use($status) {
 			if(!$status) {