diff --git a/htdocs/opensurvey/card.php b/htdocs/opensurvey/card.php
index 3fa238894e1..e27763fadd6 100644
--- a/htdocs/opensurvey/card.php
+++ b/htdocs/opensurvey/card.php
@@ -46,6 +46,11 @@ if (GETPOST('id')) {
$object=new Opensurveysondage($db);
$result=$object->fetch(0, $numsondage);
+if ($result <= 0)
+{
+ dol_print_error($db,$object->error);
+ exit;
+}
$expiredate=dol_mktime(0, 0, 0, GETPOST('expiremonth'), GETPOST('expireday'), GETPOST('expireyear'));
@@ -201,17 +206,6 @@ foreach ($toutsujet as $value)
$toutsujet=str_replace("@","
",$toutsujet);
$toutsujet=str_replace("°","'",$toutsujet);
-if (empty($object->ref)) // For survey, id is a hex string
-{
- $langs->load("errors");
- print $langs->trans("ErrorRecordNotFound");
-
- llxFooter();
-
- $db->close();
- exit;
-}
-
print '