From 2e276a095ed76a655251994eb7186790e214ba06 Mon Sep 17 00:00:00 2001 From: "green-ponies (jgen)" Date: Sun, 11 Sep 2011 21:41:46 -0400 Subject: [PATCH] Fix for Issue 22 from HungryFeline. --- core/imageboard.pack.php | 1 + 1 file changed, 1 insertion(+) diff --git a/core/imageboard.pack.php b/core/imageboard.pack.php index 9ce34abe..b586dd56 100644 --- a/core/imageboard.pack.php +++ b/core/imageboard.pack.php @@ -93,6 +93,7 @@ class Image { public static function by_random($tags=array()) { assert(is_array($tags)); $max = Image::count_images($tags); + if ($max < 1) return null; // From Issue #22 - opened by HungryFeline on May 30, 2011. $rand = mt_rand(0, $max-1); $set = Image::find_images($rand, 1, $tags); if(count($set) > 0) return $set[0];