From 4639608862523fb2b042ee13d4d54c0eca3b5b10 Mon Sep 17 00:00:00 2001 From: Aleksey Grunin <49051631+avegacms@users.noreply.github.com> Date: Fri, 19 Apr 2024 21:21:27 +0600 Subject: [PATCH] Update Model.php Fix TypeError error in the methods: doFind and doFirst when using casts --- system/Model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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;