Index: wp-includes/post.php
===================================================================
--- wp-includes/post.php	(revision 23307)
+++ wp-includes/post.php	(working copy)
@@ -758,13 +758,16 @@
  *
  * @since 3.1.0
  *
- * @param int|object $post A post
+ * @param int|object $post Post ID or post object. Optional, default is the current post from the loop.
  *
  * @return mixed The format if successful. False if no format is set. WP_Error if errors.
  */
 function get_post_format( $post = null ) {
 	$post = get_post($post);
 
+	if ( empty($post) )
+		return new WP_Error('invalid_post', __('Invalid post'));
+
 	if ( ! post_type_supports( $post->post_type, 'post-formats' ) )
 		return false;
 
