Index: wp-includes/post.php
===================================================================
--- wp-includes/post.php	(revision 18057)
+++ wp-includes/post.php	(working copy)
@@ -3839,7 +3839,7 @@
  */
 function wp_get_attachment_url( $post_id = 0 ) {
 	$post_id = (int) $post_id;
-	if ( !$post =& get_post( $post_id ) )
+	if ( !$post =& get_post( $post_id ) || 'attachment' != $post->post_type )
 		return false;
 
 	$url = '';
@@ -3859,7 +3859,7 @@
 
 	$url = apply_filters( 'wp_get_attachment_url', $url, $post->ID );
 
-	if ( 'attachment' != $post->post_type || empty( $url ) )
+	if ( empty( $url ) )
 		return false;
 
 	return $url;
