Index: /FCKeditor/trunk/_whatsnew.html
===================================================================
--- /FCKeditor/trunk/_whatsnew.html	(revision 1777)
+++ /FCKeditor/trunk/_whatsnew.html	(revision 1778)
@@ -121,4 +121,7 @@
 			having problems with SpellerPages, causing some errors to be thrown when completing
 			the spell checking in some situations.</li>
+		<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2042">#2042</a>] The FitWindow
+			command was throwing an error if executed in an editor where its relative button
+			is not present in the toolbar.</li>
 	</ul>
 	<h3>
Index: /FCKeditor/trunk/editor/_source/classes/fcktoolbarbutton.js
===================================================================
--- /FCKeditor/trunk/editor/_source/classes/fcktoolbarbutton.js	(revision 1777)
+++ /FCKeditor/trunk/editor/_source/classes/fcktoolbarbutton.js	(revision 1778)
@@ -49,12 +49,17 @@
 FCKToolbarButton.prototype.RefreshState = function()
 {
+	var uiButton = this._UIButton ;
+
+	if ( !uiButton )
+		return ;
+
 	// Gets the actual state.
 	var eState = FCK.ToolbarSet.CurrentInstance.Commands.GetCommand( this.CommandName ).GetState() ;
 
 	// If there are no state changes than do nothing and return.
-	if ( eState == this._UIButton.State ) return ;
+	if ( eState == uiButton.State ) return ;
 
 	// Sets the actual state.
-	this._UIButton.ChangeState( eState ) ;
+	uiButton.ChangeState( eState ) ;
 }
 
