diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php
index 176c70e4a5ae1b1e3bdac8c8f91e6b652fbf58a3..bb84e47ad7db1b82fc575b17b699aa1d891cfa74 100644
--- a/htdocs/core/tpl/objectline_create.tpl.php
+++ b/htdocs/core/tpl/objectline_create.tpl.php
@@ -518,7 +518,7 @@ jQuery(document).ready(function() {
 			/* focus work on a standard textarea but not if field was replaced with CKEDITOR */
 			jQuery('#dp_desc').focus();
 			/* focus if CKEDITOR */
-			if (typeof(CKEDITOR) !== 'undefined')
+			if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined" && CKEDITOR.instances[key] != "undefined")
 			{
 				var editor = CKEDITOR.instances['dp_desc'];
    				if (editor) { editor.focus(); }
@@ -624,7 +624,7 @@ jQuery(document).ready(function() {
 			/* focus work on a standard textarea but not if field was replaced with CKEDITOR */
 			jQuery('#dp_desc').focus();
 			/* focus if CKEDITOR */
-			if (typeof(CKEDITOR) !== 'undefined')
+			if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined" && CKEDITOR.instances[key] != "undefined")
 			{
 				var editor = CKEDITOR.instances['dp_desc'];
    				if (editor) { editor.focus(); }