We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 75ecedc commit 79e9859Copy full SHA for 79e9859
1 file changed
‎src/SortedCollection/TreeNode.php‎
@@ -383,8 +383,14 @@ private function incBalance()
383
$this->information += 4;
384
385
if ($this->information >= 8) {
386
- if ($this->right->information < 0) {
387
- $this->right = $this->right->rotateRight();
+ $right = $this->right;
+
388
+ if (!$right instanceof self) {
389
+ return $this;
390
+ }
391
392
+ if ($right->information < 0) {
393
+ $this->right = $right->rotateRight();
394
}
395
396
return $this->rotateLeft();
0 commit comments