Skip to content

Commit 79e9859

Browse files
committed
🚨 Fix scrutinizer
1 parent 75ecedc commit 79e9859

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

‎src/SortedCollection/TreeNode.php‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,8 +383,14 @@ private function incBalance()
383383
$this->information += 4;
384384

385385
if ($this->information >= 8) {
386-
if ($this->right->information < 0) {
387-
$this->right = $this->right->rotateRight();
386+
$right = $this->right;
387+
388+
if (!$right instanceof self) {
389+
return $this;
390+
}
391+
392+
if ($right->information < 0) {
393+
$this->right = $right->rotateRight();
388394
}
389395

390396
return $this->rotateLeft();

0 commit comments

Comments
 (0)