diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php
index 8c8049fbb2..5ac073717c 100644
--- a/wp-admin/includes/media.php
+++ b/wp-admin/includes/media.php
@@ -590,8 +590,9 @@ function get_attachment_fields_to_edit($post, $errors = null) {
 }
 
 function get_media_items( $post_id, $errors ) {
-	if ( $post_id && $post = get_post($post_id) ) {
-		if ( $post->post_type == 'attachment' )
+	if ( $post_id ) {
+		$post = get_post($post_id);
+		if ( $post && $post->post_type == 'attachment' )
 			$attachments = array($post->ID => $post);
 		else
 			$attachments = get_children("post_parent=$post_id&post_type=attachment&orderby=menu_order ASC, ID&order=DESC");