From c42ed8b7ac3586a416408ad5ee4ffd8450e5093d Mon Sep 17 00:00:00 2001
From: Jonathan Wilkes <jon.w.wilkes@gmail.com>
Date: Tue, 17 Jan 2017 06:35:45 -0500
Subject: [PATCH] fix #225: Help browser: Bad arguments for message 'open' to
 object 'pd'

---
 pd/nw/dialog_search.html | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/pd/nw/dialog_search.html b/pd/nw/dialog_search.html
index fe215b969..b423bfbaf 100644
--- a/pd/nw/dialog_search.html
+++ b/pd/nw/dialog_search.html
@@ -300,12 +300,11 @@ function file_browser_click() {
 
 function file_browser_callback(elem) {
     var doc = elem.value;
-    //pdgui.post("file callback: file is " + elem.value);
-    //pdgui.post("dir is " + pdgui.defunkify_windows_path(path.dirname(doc)));
-    //pdgui.post("file is " + pdgui.defunkify_windows_path(path.basename(doc)));
-    pdgui.doc_open(pdgui.defunkify_windows_path(path.dirname(doc)),
-        pdgui.defunkify_windows_path(path.basename(doc)));
-    display_directory(pdgui.defunkify_windows_path(path.dirname(doc)));
+    if (doc !== "") {
+        pdgui.doc_open(pdgui.defunkify_windows_path(path.dirname(doc)),
+            pdgui.defunkify_windows_path(path.basename(doc)));
+        display_directory(pdgui.defunkify_windows_path(path.dirname(doc)));
+    }
 }
 
 function console_unwrap_tag(console_elem, tag_name) {
-- 
GitLab