Index: theme.php
===================================================================
--- theme.php	(revision 18305)
+++ theme.php	(working copy)
@@ -745,6 +745,14 @@
 	if ( empty( $templates ) )
 		$templates = array("{$type}.php");
 
+	/**
+	 * Allow the use of one major filter named 'query_template'.
+	 * Only if the returned value is an array() will it be used to replace previous array().
+	 * This is to prevent accidental returns of NULLs or such.
+	 */
+	is_array( $new_templates = apply_filters( "query_template", $templates, $type ) ) and
+		!empty( $new_templates ) and ( $templates = $new_templates );
+	
 	return apply_filters( "{$type}_template", locate_template( $templates ) );
 }
 
