From da481049c1b93a05ff73928817206d0e3012db3c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 2 Jun 2020 15:45:40 +0200 Subject: [PATCH] Update commonobject.class.php --- htdocs/core/class/commonobject.class.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 7fe7fc41303..819b4b20839 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -7898,11 +7898,13 @@ abstract class CommonObject $deleteMethod=$deleteFromObject[2]; if (dol_include_once($filePath)) { $childObject = new $className($this->db); - $result= $childObject->{$deleteMethod}($this->id); - if ($result<0) { - $this->errors[] = $childObject->error; - return -1; - } + if (method_exists($childObject, $deleteMethod)) { + $result= $childObject->{$deleteMethod}($this->id); + if ($result<0) { + $this->errors[] = $childObject->error; + return -1; + } + } } else { $this->errors[] = 'Cannot find child class file ' .$filePath; return -1;