diff options
author | Joe <rbo@gmx.us> | 2024-01-09 20:20:20 +0100 |
---|---|---|
committer | Joe <rbo@gmx.us> | 2024-01-09 20:20:20 +0100 |
commit | be73738c35a3371684927146b263a3f013a1dedc (patch) | |
tree | aec9164520ded8b1174196a074b9ce7c271cab62 /i_events.go | |
parent | fix that shiet (diff) | |
download | hardflip-be73738c35a3371684927146b263a3f013a1dedc.tar.gz hardflip-be73738c35a3371684927146b263a3f013a1dedc.tar.bz2 hardflip-be73738c35a3371684927146b263a3f013a1dedc.tar.xz hardflip-be73738c35a3371684927146b263a3f013a1dedc.tar.zst hardflip-be73738c35a3371684927146b263a3f013a1dedc.zip |
in progress
Diffstat (limited to 'i_events.go')
-rw-r--r-- | i_events.go | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/i_events.go b/i_events.go index ca68e90..2484f28 100644 --- a/i_events.go +++ b/i_events.go @@ -84,21 +84,32 @@ func i_delete_host(data *HardData) { return } host := curr.Host - file_path := data.data_dir + host.Parent.path() + host.Filename - - if err := os.Remove(file_path); err != nil { - c_die("can't remove " + file_path, err) + if host == nil { + return } + // FIX: uncomment this after fix + // file_path := data.data_dir + host.Parent.path() + host.Filename + // + // if err := os.Remove(file_path); err != nil { + // c_die("can't remove " + file_path, err) + // } + var tmp *ItemsNode host.Parent.lhost.del(host) - prev := data.litems.curr.prev + if data.litems.curr != nil { + tmp = data.litems.curr.prev + } data.litems.del(curr) - if prev == nil { - prev = data.litems.head + if tmp == nil { + tmp = data.litems.head } - data.litems.curr = prev + data.litems.curr = tmp if data.litems.last != nil { data.ui.sel_max = data.litems.last.ID + } else { + data.ui.sel_max = 0 } + // FIX: segv if only one host + // FIX: segv if del last host <- this is new, fuck // FIX: doesn't del the first one visually } |