Bail if post is empty. Props mdawaffe. fixes #5019

git-svn-id: http://svn.automattic.com/wordpress/trunk@6142 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2007-09-20 18:25:14 +00:00
parent 3542e01f19
commit 4a03a94051

View File

@ -358,7 +358,7 @@ function edit_comment_link( $link = 'Edit This', $before = '', $after = '' ) {
function get_previous_post($in_same_cat = false, $excluded_categories = '') {
global $post, $wpdb;
if( !is_single() || is_attachment() )
if( empty($post) || !is_single() || is_attachment() )
return null;
$current_post_date = $post->post_date;
@ -391,7 +391,7 @@ function get_previous_post($in_same_cat = false, $excluded_categories = '') {
function get_next_post($in_same_cat = false, $excluded_categories = '') {
global $post, $wpdb;
if( !is_single() || is_attachment() )
if( empty($post) || !is_single() || is_attachment() )
return null;
$current_post_date = $post->post_date;