miqt: fixes for string parsing of blank links in docker output

This commit is contained in:
mappu 2025-01-06 18:35:12 +13:00
parent bc2216a9f8
commit 4d0b2a7a8c

16
main.go
View File

@ -506,6 +506,10 @@ func (self *DockerGUI) refresh_containers() {
containers := strings.Split(strings.TrimSpace(string(output)), "\n")
for _, container := range containers {
parts := strings.Split(container, "\t")
if len(parts) == 1 {
continue
}
id := parts[0]
name := parts[1]
image := parts[2]
@ -540,6 +544,10 @@ func (self *DockerGUI) refresh_images() {
images := strings.Split(strings.TrimSpace(string(output)), "\n")
for _, image := range images {
parts := strings.Split(image, "\t")
if len(parts) == 1 {
continue
}
id := parts[0]
repository := parts[1]
tag := parts[2]
@ -568,6 +576,10 @@ func (self *DockerGUI) refresh_networks() {
networks := strings.Split(strings.TrimSpace(string(output)), "\n")
for _, network := range networks {
parts := strings.Split(network, "\t")
if len(parts) == 1 {
continue
}
id := parts[0]
name := parts[1]
driver := parts[2]
@ -594,6 +606,10 @@ func (self *DockerGUI) refresh_volumes() {
volumes := strings.Split(strings.TrimSpace(string(output)), "\n")
for _, volume := range volumes {
parts := strings.Split(volume, "\t")
if len(parts) == 1 {
continue
}
name := parts[0]
driver := parts[1]
mountpoint := parts[2]