From c8ead9801c3e9b0a0ac14308ded2a4028feedea6 Mon Sep 17 00:00:00 2001 From: ryan Date: Thu, 19 Nov 2009 17:58:11 +0000 Subject: [PATCH] Return if no comment queried git-svn-id: http://svn.automattic.com/wordpress/trunk@12223 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/comment.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wp-includes/comment.php b/wp-includes/comment.php index 62eca8f72..6af1492d3 100644 --- a/wp-includes/comment.php +++ b/wp-includes/comment.php @@ -132,6 +132,7 @@ function get_approved_comments($post_id) { */ function &get_comment(&$comment, $output = OBJECT) { global $wpdb; + $null = null; if ( empty($comment) ) { if ( isset($GLOBALS['comment']) ) @@ -146,6 +147,8 @@ function &get_comment(&$comment, $output = OBJECT) { $_comment = & $GLOBALS['comment']; } elseif ( ! $_comment = wp_cache_get($comment, 'comment') ) { $_comment = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_ID = %d LIMIT 1", $comment)); + if ( ! $_comment ) + return $null; wp_cache_add($_comment->comment_ID, $_comment, 'comment'); } }