diff --git a/system/Model.php b/system/Model.php index c4ca9b6cc6e9..03ca7525ec76 100644 --- a/system/Model.php +++ b/system/Model.php @@ -210,7 +210,7 @@ protected function doFind(bool $singleton, $id = null) $row = $builder->get()->getResult($this->tempReturnType); } - if ($useCast) { + if ($useCast && $row !== null) { $row = $this->convertToReturnType($row, $returnType); $this->tempReturnType = $returnType;