diff --git a/core/js/oc-dialogs.js b/core/js/oc-dialogs.js
index 5cf45fe0fb9a4bd761fb4dd256335872b04e7919..5a5bdc33d5d509af328bff6416341bd53cc41bfa 100644
--- a/core/js/oc-dialogs.js
+++ b/core/js/oc-dialogs.js
@@ -194,7 +194,10 @@ var OCdialogs = {
 						});
 					} else {
 						datapath = self.$filePicker.data('path');
-						datapath += '/' + self.$filelist.find('tr.filepicker_element_selected').data('entryname');
+						var selectedName = self.$filelist.find('tr.filepicker_element_selected').data('entryname');
+						if (selectedName) {
+							datapath += '/' + selectedName;
+						}
 					}
 					callback(datapath);
 					self.$filePicker.ocdialog('close');