Skip to content

Commit

Permalink
Don't panic with widgets without a canvas
Browse files Browse the repository at this point in the history
  • Loading branch information
dweymouth authored Oct 9, 2024
1 parent f7de9ff commit aa52507
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/tooltip_layer.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ func DestroyToolTipLayerForPopup(popUp *widget.PopUp) {
}

func ShowToolTipAtMousePosition(canvas fyne.Canvas, pos fyne.Position, text string) *ToolTipHandle {
if canvas == nil {
fyne.LogError("", errors.New("no canvas associated with tool tip widget"))
return nil
}

lastToolTipShownUnixMilli = time.Now().UnixMilli()
overlay := canvas.Overlays().Top()
handle := &ToolTipHandle{canvas: canvas, overlay: overlay}
Expand Down

0 comments on commit aa52507

Please sign in to comment.