- var label = ( this.state == CKEDITOR.TRISTATE_OFF )\r
- ? lang.maximize : lang.minimize;\r
- var buttonNode = editor.element.getDocument().getById( button._.id );\r
- buttonNode.getChild( 1 ).setHtml( label );\r
- buttonNode.setAttribute( 'title', label );\r
- buttonNode.setAttribute( 'href', 'javascript:void("' + label + '");' );\r
+ // Only try to change the button if it exists (#6166)\r
+ if( button )\r
+ {\r
+ var label = ( this.state == CKEDITOR.TRISTATE_OFF )\r
+ ? lang.maximize : lang.minimize;\r
+ var buttonNode = editor.element.getDocument().getById( button._.id );\r
+ buttonNode.getChild( 1 ).setHtml( label );\r
+ buttonNode.setAttribute( 'title', label );\r
+ buttonNode.setAttribute( 'href', 'javascript:void("' + label + '");' );\r
+ }\r