diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index 37f1d6036c6..5b477ace9c8 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -899,7 +899,10 @@ class DolGraph } $legends=array(); - $nblot=count($this->data[0])-1; // -1 to remove legend + $nblot=0; + if (is_array($this->data) && is_array($this->data[0])) { + $nblot=count($this->data[0])-1; // -1 to remove legend + } if ($nblot < 0) dol_syslog('Bad value for property ->data. Must be set by mydolgraph->SetData before calling mydolgrapgh->draw', LOG_WARNING); $firstlot=0; // Works with line but not with bars