Skip to content

Commit

Permalink
prevent from crash on image not found
Browse files Browse the repository at this point in the history
  • Loading branch information
nwg-piotr committed Sep 28, 2023
1 parent 23aff33 commit 6fdd055
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,11 @@ func pinnedButton(ID string) *gtk.Box {
}
}

button.SetImage(image)
button.SetImagePosition(gtk.POS_TOP)
button.SetAlwaysShowImage(true)
if image != nil {
button.SetImage(image)
button.SetImagePosition(gtk.POS_TOP)
button.SetAlwaysShowImage(true)
}
button.SetTooltipText(getName(ID))
pixbuf, _ := gdk.PixbufNewFromFileAtSize(filepath.Join(dataHome, "nwg-dock/images/task-empty.svg"),
imgSizeScaled, imgSizeScaled/8)
Expand Down Expand Up @@ -356,9 +358,11 @@ func taskButton(t task, instances []task) *gtk.Box {
}
}

button.SetImage(image)
button.SetImagePosition(gtk.POS_TOP)
button.SetAlwaysShowImage(true)
if image != nil {
button.SetImage(image)
button.SetImagePosition(gtk.POS_TOP)
button.SetAlwaysShowImage(true)
}
button.SetTooltipText(getName(t.ID))
var img *gtk.Image
if len(instances) < 2 {
Expand Down

0 comments on commit 6fdd055

Please sign in to comment.