Index: index.php
===================================================================
--- index.php	(revision 8754)
+++ index.php	(working copy)
@@ -143,6 +143,24 @@
     exit;
 }
 
+//  Survey does not exist
+if (!is_array(getSurveyInfo($surveyid, $_SESSION['s_lang'])))
+{
+    require_once(dirname(__FILE__).'/classes/core/language.php');
+    $baselang = GetBaseLanguageFromSurveyID($surveyid);
+    $clang = new limesurvey_lang($baselang);
+    sendcacheheaders();
+    doHeader();
+    //SURVEY DOES NOT EXIST. POLITELY EXIT.
+    echo templatereplace(file_get_contents("$standardtemplaterootdir/default/startpage.pstpl"));
+    echo "\t<center><br />\n"
+    ."\t".$clang->gT("Sorry. There is no matching survey.")."<br /></center>&nbsp;\n";
+    echo templatereplace(file_get_contents("$standardtemplaterootdir/default/endpage.pstpl"));
+    doFooter();
+    exit;
+}
+
+
 if ($surveyid &&
 $issurveyactive===false &&
 isset ($surveyPreview_require_Auth) &&
