Skip to content

Commit fd83c1b

Browse files
committed
- fixed null reference check
1 parent 65262ad commit fd83c1b

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

src/MailQ/Entities/v2/CampaignEntity.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,15 @@ public function getName() {
4848
}
4949

5050
public function getCreated() {
51-
return $this->created->format('Y-m-d\TH:i:s.u');
51+
if ($this->created != null) {
52+
return $this->created->format('Y-m-d\TH:i:s.u');
53+
}
54+
else {
55+
return null;
56+
}
5257
}
5358

59+
5460
public function getCreatedAsDateTime() {
5561
return $this->created;
5662
}

src/MailQ/Entities/v2/NewsletterEntity.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,21 @@ public function getStatus() {
146146
}
147147

148148
public function getFrom() {
149-
return $this->from->format('Y-m-d\TH:i:s.u');
149+
if ($this->from != null) {
150+
return $this->from->format('Y-m-d\TH:i:s.u');
151+
}
152+
else {
153+
return null;
154+
}
150155
}
151156

152157
public function getTo() {
153-
return $this->to->format('Y-m-d\TH:i:s.u');
158+
if ($this->to != null) {
159+
return $this->to->format('Y-m-d\TH:i:s.u');
160+
}
161+
else {
162+
return null;
163+
}
154164
}
155165

156166
public function getFromAsDateTime() {

0 commit comments

Comments
 (0)