From 479648e7c181998dbde179e69f2fff7f16adce21 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 21 Apr 2018 20:28:30 +0200 Subject: [PATCH] Fix #1352 --- app/Services/Bunq/Object/UserCompany.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/Services/Bunq/Object/UserCompany.php b/app/Services/Bunq/Object/UserCompany.php index 1ed89f6faa..13508afdb5 100644 --- a/app/Services/Bunq/Object/UserCompany.php +++ b/app/Services/Bunq/Object/UserCompany.php @@ -98,6 +98,13 @@ class UserCompany extends BunqObject */ public function __construct(array $data) { + if (\count($data) === 0 || (isset($data['id']) && (int)$data['id'] === 0)) { + $this->id = 0; + $this->created = new Carbon; + $this->updated = new Carbon; + + return; + } $this->id = (int)$data['id']; $this->created = Carbon::createFromFormat('Y-m-d H:i:s.u', $data['created']); $this->updated = Carbon::createFromFormat('Y-m-d H:i:s.u', $data['updated']);