Index: wp-includes/functions.php
===================================================================
--- wp-includes/functions.php	(revision 3569)
+++ wp-includes/functions.php	(working copy)
@@ -1400,7 +1400,7 @@
 	global $wpdb;
 
 	// No point in doing all this work if we didn't match any posts.
-	if ( !$posts )
+	if ( !$posts || !$posts[0]->ID )
 		return;
 
 	// Get the categories for all the posts
