Skip to content

Commit 10f1c39

Browse files
committed
Ensure that DateAndTime and Date are not null before using them
1 parent 405852f commit 10f1c39

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

bundle/FieldHandler/Custom/DateAndTimeFieldHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class DateAndTimeFieldHandler implements CustomLegacyFieldHandlerInterface
1414
*/
1515
public function supports(Value $value)
1616
{
17-
return $value instanceof DateAndTimeValue;
17+
return $value instanceof DateAndTimeValue && $value->value !== null;
1818
}
1919

2020
/**
@@ -32,4 +32,4 @@ public function getLegacyValue(Value $value, FieldDefinition $fieldDefinition)
3232
{
3333
return new LegacyData($fieldDefinition->id, 0, $value->value->getTimestamp(),'');
3434
}
35-
}
35+
}

bundle/FieldHandler/Custom/DateFieldHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class DateFieldHandler implements CustomLegacyFieldHandlerInterface
1414
*/
1515
public function supports(Value $value)
1616
{
17-
return $value instanceof DateValue;
17+
return $value instanceof DateValue && $value->date !== null;
1818
}
1919

2020
/**
@@ -32,4 +32,4 @@ public function getLegacyValue(Value $value, FieldDefinition $fieldDefinition)
3232
{
3333
return new LegacyData($fieldDefinition->id, 0, $value->date->getTimestamp(), '');
3434
}
35-
}
35+
}

0 commit comments

Comments
 (0)