Index: wp-includes/general-template.php
===================================================================
--- wp-includes/general-template.php	(revision 14019)
+++ wp-includes/general-template.php	(working copy)
@@ -1068,8 +1068,26 @@
 	if ( !is_array($cache) )
 		$cache = array();
 
-	// Quick check. If we have no posts at all, abort!
-	if ( !$posts ) {
+	// Quick check if at least one element in $posts is published post
+	if ( $posts ) {
+		$flag=false;
+		foreach($posts as $post){
+			if($post->post_type == 'post' && $post->post_status == 'publish'){
+				$flag = true;
+				break;
+			}
+		}
+		//If we still don't know if we have or no published posts
+		if(!$flag){
+			$gotsome = $wpdb->get_var("SELECT 1 as test FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' LIMIT 1");
+			if ( !$gotsome ) {
+				$cache[ $key ] = '';
+				wp_cache_set( 'get_calendar', $cache, 'calendar' );
+				return;
+			}
+		}
+	// If we have no posts at all, abort!
+	} else {
 		$gotsome = $wpdb->get_var("SELECT 1 as test FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' LIMIT 1");
 		if ( !$gotsome ) {
 			$cache[ $key ] = '';
