From 20c4b5d177e3f097eb23e587f5a741ce0f4e42f4 Mon Sep 17 00:00:00 2001 From: Stu Date: Sat, 13 Dec 2025 22:37:27 -0500 Subject: [PATCH] Harden drag handler: check data/text and recover --- cmd/gtkplayer/main.go | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/cmd/gtkplayer/main.go b/cmd/gtkplayer/main.go index c520349..95e9dd0 100644 --- a/cmd/gtkplayer/main.go +++ b/cmd/gtkplayer/main.go @@ -288,13 +288,19 @@ func setupDragDest(p *pane, win *gtk.Window) { if data == nil { return } - uris := data.GetURIs() - if len(uris) == 0 { + var path string + if uris := data.GetURIs(); len(uris) > 0 { + path = uriToPath(uris[0]) + } + if path == "" { + if txt := data.GetText(); txt != "" { + path = uriToPath(txt) + } + } + if path == "" { return } - if path := uriToPath(uris[0]); path != "" { - loadIntoPane(p, path) - } + loadIntoPane(p, path) }) }