about summary refs log tree commit diff stats
path: root/src/server/buffer.nim
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/buffer.nim')
-rw-r--r--src/server/buffer.nim9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/server/buffer.nim b/src/server/buffer.nim
index 424c210f..fa63f3a9 100644
--- a/src/server/buffer.nim
+++ b/src/server/buffer.nim
@@ -1567,10 +1567,11 @@ proc click*(buffer: Buffer; cursorx, cursory: int): ClickResult {.proxy.} =
   let clickable = buffer.getCursorClickable(cursorx, cursory)
   if buffer.config.scripting:
     let element = buffer.getCursorElement(cursorx, cursory)
-    let event = newEvent(buffer.window.toAtom(satClick), element)
-    (called, canceled) = buffer.window.dispatchEvent(event, element)
-    if called:
-      buffer.do_reshape()
+    if element != nil:
+      let event = newEvent(buffer.window.toAtom(satClick), element)
+      (called, canceled) = buffer.window.dispatchEvent(event, element)
+      if called:
+        buffer.do_reshape()
   if not canceled:
     if clickable != nil:
       var res = buffer.click(clickable)