Index: wp-includes/post-template.php
===================================================================
--- wp-includes/post-template.php	(revision 10519)
+++ wp-includes/post-template.php	(working copy)
@@ -926,15 +926,16 @@
 
 	$post_title = attribute_escape($_post->post_title);
 	
-	if ( $text ) {
+	if( $text ) {
 		$link_text = attribute_escape($text);
-	} elseif ( ( is_int($size) && $size != 0 ) or ( is_string($size) && $size != 'none' ) or $size != false ) {
+	} elseif( ( is_int($size) && $size != 0 ) or ( is_string($size) && $size != 'none' ) or $size != false ) {
 		$link_text = wp_get_attachment_image($id, $size, $icon);
-	} else {
+	}
+
+	if( trim($link_text) == '' )
 		$link_text = $_post->post_title;
-	}
 	
-	return apply_filters( 'wp_get_attachment_link', "<a href='$url' title='$post_title'>$link_text</a>", $id, $size, $permalink, $icon );
+	return apply_filters( 'wp_get_attachment_link', "<a href='$url' title='$post_title'>$link_text</a>", $id, $size, $permalink, $icon, $text );
 }
 
 /**
