Index: media.php
===================================================================
--- wp-admin/includes/media.php	(revision 12099)
+++ wp-admin/includes/media.php	(working copy)
@@ -807,6 +807,14 @@
  */
 function image_size_input_fields( $post, $checked = '' ) {
 
+		// Validate params
+		if ($checked) {
+			$downsize = image_downsize($post->ID, $checked);
+			$enabled = ( $downsize[3] || 'full' == $checked );
+			if (!$enabled)
+				$checked = '';
+		}
+
 		// get a list of the actual pixel dimensions of each possible intermediate version of this image
 		$size_names = array('thumbnail' => __('Thumbnail'), 'medium' => __('Medium'), 'large' => __('Large'), 'full' => __('Full size'));
 
@@ -816,9 +824,6 @@
 			// is this size selectable?
 			$enabled = ( $downsize[3] || 'full' == $size );
 			$css_id = "image-size-{$size}-{$post->ID}";
-			// if this size is the default but that's not available, don't select it
-			if ( $checked && !$enabled )
-				$checked = '';
 			// if $checked was not specified, default to the first available size that's bigger than a thumbnail
 			if ( !$checked && $enabled && 'thumbnail' != $size )
 				$checked = $size;
