Index: wp-includes/functions.php
===================================================================
--- wp-includes/functions.php	(revision 3332)
+++ wp-includes/functions.php	(working copy)
@@ -1673,6 +1673,11 @@
 }
 
 function get_template() {
+	$template = get_settings('template');
+	if (!file_exists(get_theme_root() . "/$template")) { //works for dirs too
+		update_option('template', 'default');
+		update_option('stylesheet', 'default');
+	}
 	return apply_filters('template', get_settings('template'));
 }
