From 0f640e67f443e39b813c08eb76eaf3c6f09f32d0 Mon Sep 17 00:00:00 2001 From: Samuel Georges Date: Tue, 30 Jan 2024 13:00:05 +1100 Subject: [PATCH] Exception handling --- src/Database/Models/DeferredBinding.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Database/Models/DeferredBinding.php b/src/Database/Models/DeferredBinding.php index b00c5175f..30cedbfa8 100644 --- a/src/Database/Models/DeferredBinding.php +++ b/src/Database/Models/DeferredBinding.php @@ -206,7 +206,7 @@ protected function deleteSlaveRecord() // Only delete it if the relationship is null $foreignKey = array_get($options, 'key', $masterObject->getForeignKey()); - if (!$relatedObj->$foreignKey) { + if ($foreignKey && !$relatedObj->$foreignKey) { $relatedObj->delete(); } }