aboutsummaryrefslogtreecommitdiffstats
path: root/i_events.go
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--i_events.go27
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
}