stop on json data error

This commit is contained in:
Fred Tempez 2024-03-14 19:09:00 +01:00
parent 5846c111fe
commit f924a2b2b3

View File

@ -129,7 +129,7 @@ class JsonDb extends \Prowebcraft\Dot
}
}
$this->data = json_decode(file_get_contents($this->db), true);
if (!$this->data === null) {
if (!$this->data === null && json_last_error() !== JSON_ERROR_NONE) {
throw new \InvalidArgumentException('Database file ' . $this->db
. ' contains invalid json object. Please validate or remove file');
}