diff --git a/htdocs/product.class.php b/htdocs/product.class.php
index 06ac538cccd..4203c23f693 100644
--- a/htdocs/product.class.php
+++ b/htdocs/product.class.php
@@ -891,19 +891,22 @@ class Product
$pdir = get_exdir($this->id) . $this->id ."/photos/";
$dir = $sdir . '/'. $pdir;
- $handle=opendir($dir);
-
- while (($file = readdir($handle))!==false)
+ if ( file_exists($dir))
{
- if (is_file($dir.$file))
+ $handle=opendir($dir);
+
+ while (($file = readdir($handle))!==false)
{
- $photo = $file;
+ if (is_file($dir.$file))
+ {
+ $photo = $file;
+ }
+ }
+
+ if (strlen($photo))
+ {
+ print '
';
}
- }
-
- if (strlen($photo))
- {
- print '
';
}
}
/**