diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index dda350865af..0944918f815 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -8325,10 +8325,10 @@ class Form
$nophoto = 'company';
} else {
$nophoto = '/public/theme/common/user_anonymous.png';
- if ($object->gender == 'man') {
+ if (!empty($object->gender) && $object->gender == 'man') {
$nophoto = '/public/theme/common/user_man.png';
}
- if ($object->gender == 'woman') {
+ if (!empty($object->gender) && $object->gender == 'woman') {
$nophoto = '/public/theme/common/user_woman.png';
}
}