From 936836e5f10c402cdbbf1e45f5fb0ca1a3d2d207 Mon Sep 17 00:00:00 2001
From: Henning Leutz <leutz@pcsg.de>
Date: Fri, 19 Feb 2016 11:08:08 +0100
Subject: [PATCH] destroy und create stabiler gemacht; wirft nicht mehr so
 schnell fehler

---
 bin/Editor.js | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/bin/Editor.js b/bin/Editor.js
index 14633bf..d19ea7a 100644
--- a/bin/Editor.js
+++ b/bin/Editor.js
@@ -80,7 +80,9 @@ define('package/quiqqer/ckeditor4/bin/Editor', [
                 window.CKEDITOR.on('instanceReady', function (ev) {
                     var Editor = QUI.Controls.getById(ev.editor.name);
 
-                    Editor.$onInstanceReadyListener(ev);
+                    if (Editor && "$onInstanceReadyListener" in Editor) {
+                        Editor.$onInstanceReadyListener(ev);
+                    }
                 });
 
                 // http://docs.ckeditor.com/#!/guide/dev_howtos_dialog_windows
@@ -233,12 +235,14 @@ define('package/quiqqer/ckeditor4/bin/Editor', [
         $onDestroy: function (Editor) {
             var Instance = Editor.getInstance();
 
+            if (!Instance || !(name in Instance)) {
+                return;
+            }
+
             if (window.CKEDITOR.instances[Instance.name]) {
                 try {
                     window.CKEDITOR.instances[Instance.name].destroy(true);
-
                 } catch (e) {
-
                 }
 
                 window.CKEDITOR.instances[Instance.name] = null;
-- 
GitLab