Handle wrong path

This commit is contained in:
Dennis Eichhorn 2017-04-01 13:58:26 +02:00
parent 0f19264e86
commit 1553e1f28e

View File

@ -88,8 +88,8 @@ class InfoManager
*/
public function load() /* : void */
{
if (!file_exists($this->path)) {
throw new PathException($this->path);
if ($this->path === false || !file_exists($this->path)) {
throw new PathException((string) $this->path);
}
$this->info = json_decode(file_get_contents($this->path), true);
@ -105,8 +105,8 @@ class InfoManager
*/
public function update() /* : void */
{
if (!file_exists($this->path)) {
throw new PathException($this->path);
if ($this->path === false || !file_exists($this->path)) {
throw new PathException((string) $this->path);
}
file_put_contents($this->path, json_encode($this->info, JSON_PRETTY_PRINT));