Index: /CKEditor/trunk/CHANGES.html
===================================================================
--- /CKEditor/trunk/CHANGES.html	(revision 3965)
+++ /CKEditor/trunk/CHANGES.html	(revision 3966)
@@ -180,4 +180,5 @@
 		</ul></li>
 		<li><a href="http://dev.fckeditor.net/ticket/4085">#4085</a> : Paste and Paste from Word dialogs were not well styled in IE+RTL.</li>
+		<li><a href="http://dev.fckeditor.net/ticket/4101">#4101</a> : Now it is possible to close dialog before gets focus.</li>
 	</ul>
 	<h3>
Index: /CKEditor/trunk/_source/plugins/dialogui/plugin.js
===================================================================
--- /CKEditor/trunk/_source/plugins/dialogui/plugin.js	(revision 3965)
+++ /CKEditor/trunk/_source/plugins/dialogui/plugin.js	(revision 3966)
@@ -823,5 +823,6 @@
 				{
 					this._.disabled = false;
-					this.getElement().removeClass( 'disabled' );
+					var element = this.getElement();
+					element && element.removeClass( 'disabled' );
 				},
 
@@ -906,5 +907,9 @@
 
 					// GECKO BUG: setTimeout() is needed to workaround invisible selections.
-					setTimeout( function(){ me.getInputElement().$.focus(); }, 0 );
+					setTimeout( function()
+						{
+							var element = me.getInputElement();
+							element && element.$.focus();
+						}, 0 );
 				},
 
@@ -918,5 +923,13 @@
 
 					// GECKO BUG: setTimeout() is needed to workaround invisible selections.
-					setTimeout( function(){ var e = me.getInputElement().$; e.focus(); e.select(); }, 0 );
+					setTimeout( function()
+						{
+							var e = me.getInputElement()
+							if ( e )
+							{
+								e.$.focus();
+								e.$.select();
+							}
+						}, 0 );
 				},
 
