Skip to content

Commit 5c05447

Browse files
avegacmskenjis
authored andcommitted
Fix bug #8806
Bug: when the query ($this->first()) result returns NULL we get TypeError
1 parent 1969472 commit 5c05447

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

system/Model.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ protected function doFirst()
318318

319319
$row = $builder->limit(1, 0)->get()->getFirstRow($this->tempReturnType);
320320

321-
if ($useCast) {
321+
if ($useCast && $row !== null) {
322322
$row = $this->convertToReturnType($row, $returnType);
323323

324324
$this->tempReturnType = $returnType;

0 commit comments

Comments
 (0)