refactor: count on null

This commit is contained in:
HDVinnie
2020-02-12 19:15:58 -05:00
parent 336242a6ba
commit 285ecfa38b
7 changed files with 14 additions and 14 deletions
+1 -1
View File
@@ -485,7 +485,7 @@ class CommentController extends Controller
];
}
$selected = mt_rand(0, count($thankArray) - 1);
$selected = mt_rand(0, (is_countable($thankArray) ? count($thankArray) : 0) - 1);
$comment->content = $thankArray[$selected];
$comment->user_id = $user->id;
$comment->torrent_id = $torrent->id;