diff --git a/wp-includes/media.php b/wp-includes/media.php
index e63e5bb..1693ec8 100644
--- a/wp-includes/media.php
+++ b/wp-includes/media.php
@@ -2320,14 +2320,14 @@ function get_post_galleries_images( $post_id = 0 ) {
  *
  * @param int $post_id Optional. Post ID.
  * @param boolean $html Whether to return HTML or data
- * @return array Gallery data and srcs parsed from the expanded shortcode
+ * @return string|array Gallery data and srcs parsed from the expanded shortcode
  */
 function get_post_gallery( $post_id = 0, $html = true ) {
 	if ( ! $post = get_post( $post_id ) )
-		return array();
+		return $html ? '' : array();
 
 	if ( ! has_shortcode( $post->post_content, 'gallery' ) )
-		return array();
+		return $html ? '' : array();
 
 	$data = get_content_galleries( $post->post_content, $html, false, 1 );
 	return reset( $data );
