diff --git a/htdocs/core/boxes/box_actions.php b/htdocs/core/boxes/box_actions.php
index fb0f93086d2..ac0df03184a 100644
--- a/htdocs/core/boxes/box_actions.php
+++ b/htdocs/core/boxes/box_actions.php
@@ -220,7 +220,9 @@ class box_actions extends ModeleBoxes
if (!empty($conf->global->SHOW_DIALOG_HOMEPAGE)) {
$actioncejour = false;
$contents = $this->info_box_contents;
- $nblines = count($contents);
+ if (is_countable($contents) && count($contents) > 0) {
+ $nblines = count($contents);
+ }
if ($contents[0][0]['text'] != $langs->trans("NoActionsToDo")) {
$out .= '
trans("ActionsToDo").'">';
$out .= '
';
diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php
index ae4afc695e6..452d0ca4bb5 100644
--- a/htdocs/core/lib/files.lib.php
+++ b/htdocs/core/lib/files.lib.php
@@ -1567,7 +1567,9 @@ function dol_meta_create($object)
}
if (is_dir($dir)) {
- $nblines = count($object->lines);
+ if (is_countable($object->lines) && count($object->lines) > 0) {
+ $nblines = count($object->lines);
+ }
$client = $object->thirdparty->name." ".$object->thirdparty->address." ".$object->thirdparty->zip." ".$object->thirdparty->town;
$meta = "REFERENCE=\"".$object->ref."\"
DATE=\"" . dol_print_date($object->date, '')."\"