diff --git a/library/think/model/relation/BelongsToMany.php b/library/think/model/relation/BelongsToMany.php index 9eeb88dd..ec0eb440 100644 --- a/library/think/model/relation/BelongsToMany.php +++ b/library/think/model/relation/BelongsToMany.php @@ -162,7 +162,9 @@ class BelongsToMany extends Relation public function find($data = null) { $result = $this->buildQuery()->find($data); - $this->hydratePivot([$result]); + if ($result) { + $this->hydratePivot([$result]); + } return $result; }