From 400d228e51b879582d93c5fa80aa2250711281e9 Mon Sep 17 00:00:00 2001 From: Marina Glancy Date: Tue, 20 Mar 2012 08:56:31 +0800 Subject: [PATCH] MDL-32106: fixed JS bug - when html element did not exist the script stopped --- repository/filepicker.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/repository/filepicker.js b/repository/filepicker.js index c6ac844ba17..540fd6383ef 100644 --- a/repository/filepicker.js +++ b/repository/filepicker.js @@ -669,13 +669,13 @@ M.core_filepicker.init = function(Y, options) { params['author'] = author.get('value'); } - if (this.options.env == 'editor') { + if (this.options.externallink && this.options.env == 'editor') { // in editor, images are stored in '/' only params.savepath = '/'; // when image or media button is clicked if ( this.options.return_types != 1 ) { - var linkexternal = Y.one('#linkexternal-'+client_id).get('checked'); - if (linkexternal) { + var linkexternal = Y.one('#linkexternal-'+client_id); + if (linkexternal && linkexternal.get('checked')) { params['linkexternal'] = 'yes'; } } else {