Index: src/wp-admin/includes/template.php
===================================================================
--- src/wp-admin/includes/template.php	(revision 31248)
+++ src/wp-admin/includes/template.php	(working copy)
@@ -1217,9 +1217,10 @@
  * @param string $page The slug-name of the settings page on which to show the section (general, reading, writing, ...).
  * @param string $section The slug-name of the section of the settings page in which to show the box (default, ...).
  * @param array $args Additional arguments
+ * @return true|WP_Error Will return WP_Error if the page and section have not been defined, true otherwise.
  */
 function add_settings_field($id, $title, $callback, $page, $section = 'default', $args = array()) {
-	global $wp_settings_fields;
+	global $wp_settings_fields, $wp_settings_sections;
 
 	if ( 'misc' == $page ) {
 		_deprecated_argument( __FUNCTION__, '3.0', __( 'The miscellaneous options group has been removed. Use another settings group.' ) );
@@ -1231,7 +1232,26 @@
 		$page = 'reading';
 	}
 
+	$built_in_pages_and_sections = array(
+		'discussion' => array( 'default', 'avatars' ),
+		'general' => array( 'default' ),
+		'media' => array( 'default', 'embeds', 'uploads' ),
+		'permalink' => array( 'optional' ),
+		'reading' => array( 'default' ),
+		'writing' => array( 'default', 'remote_publishing' ),
+	);
+
+	// check the built-in pages and sections
+	$section_check = ! empty( $built_in_pages_and_sections[$page] ) && in_array( $section, $built_in_pages_and_sections[$page] );
+
+	if ( ! $section_check ) {
+		// check any sections added by add_settings_section
+		$section_check = ! empty( $wp_settings_sections[$page][$section] );
+	}
+
 	$wp_settings_fields[$page][$section][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback, 'args' => $args);
+
+	return ! $section_check ? new WP_Error( 'invalid_settings_section', sprintf( __('Settings page \'%s\', section \'%s\' does not exist.'), $page, $section ) ) : $section_check;
 }
 
 /**
