Skip to content

Commit 86bca52

Browse files
Fixing resize split can cause crashes when node is root
Fixing resize split can cause crashes when node is root. "Regression" of micro-editor#3983 where ResizeSplit() assumed that the root node always has a single child which aligns to the previous behavior
1 parent e4a92a1 commit 86bca52

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

internal/views/splits.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ func (n *Node) hResizeSplit(i int, size int) bool {
186186
// ResizeSplit resizes a certain split to a given size
187187
func (n *Node) ResizeSplit(size int) bool {
188188
// TODO: `size < 0` does not work for some reason
189-
if size <= 0 {
189+
if size <= 0 || n.parent == nil {
190190
return false
191191
}
192192
if len(n.parent.children) <= 1 {

0 commit comments

Comments
 (0)