From 99a494deb63b29fa022266cb65f306a300914807 Mon Sep 17 00:00:00 2001 From: Dougal Campbell Date: Tue, 7 Oct 2003 18:19:47 +0000 Subject: [PATCH] Fixed potential infinite loop if there are no posts git-svn-id: https://develop.svn.wordpress.org/trunk@425 602fd350-edb4-49c9-b593-d223f7449a82 --- b2calendar.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/b2calendar.php b/b2calendar.php index 5c453d8762..35b5209bc1 100644 --- a/b2calendar.php +++ b/b2calendar.php @@ -56,6 +56,11 @@ require_once($abspath.$b2inc.'/b2template.functions.php'); require_once($abspath.$b2inc.'/b2functions.php'); require_once($abspath.$b2inc.'/b2vars.php'); +// Quick check. If we have no posts at all, abort! +$gotsome = $wpdb->get_var("SELECT ID from $tableposts WHERE post_status = 'publish' AND post_category > 0 ORDER BY post_date DESC LIMIT 1"); +if (!$gotsome) + return; + $w = $HTTP_GET_VARS['w']; if (isset($HTTP_GET_VARS['w'])) { $w = $HTTP_GET_VARS['w'];