From a21fa94f1421bf25c9dc83f933a9140441fe0048 Mon Sep 17 00:00:00 2001 From: Zander Otavka Date: Tue, 4 Aug 2015 15:06:12 -0700 Subject: [PATCH] Fix error in floatingUIExample.js. Script would crash if the user left clicked somewhere not on an overlay. --- examples/example/ui/floatingUIExample.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/example/ui/floatingUIExample.js b/examples/example/ui/floatingUIExample.js index d661890254..7270a5a13f 100644 --- a/examples/example/ui/floatingUIExample.js +++ b/examples/example/ui/floatingUIExample.js @@ -170,10 +170,10 @@ function onMouseDown(event) { function onMouseUp(event) { if (event.isLeftButton) { var overlay = OverlayManager.findAtPoint({ x: event.x, y: event.y }); - if (overlay === mouseDown.overlay) { + if (overlay && overlay === mouseDown.overlay) { if (overlay.attachedPanel === bluePanel) { overlay.destroy(); - } else if (overlay) { + } else { var oldPos = overlay.offsetPosition; var newPos = { x: Number(oldPos.x),