From aa525072d2786b11a7e5a4012aeda14dde769cb9 Mon Sep 17 00:00:00 2001 From: Drew Weymouth Date: Wed, 9 Oct 2024 16:00:22 -0700 Subject: [PATCH] Don't panic with widgets without a canvas --- internal/tooltip_layer.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/internal/tooltip_layer.go b/internal/tooltip_layer.go index 088236d..515a1cd 100644 --- a/internal/tooltip_layer.go +++ b/internal/tooltip_layer.go @@ -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}