title: Cannot read property 'getWidth' of undefined
body: <p>I have below code which is defined inside a function which actually set width of parent component and do layout...this function is called from 4 places and at one place there is scenario that below error comes, you can see i have checked for undefined but still it is going inside this IF and i get error :( please help identify issue</p>
  
  <p>Ext Js 3.4.2</p>
  
  <p><strong>ERROR</strong></p>
  
  <blockquote>
    <p>Uncaught TypeError: Cannot read property 'getWidth' of undefined</p>
  </blockquote>
  
  <p><strong>CODE</strong></p>
  
  <pre><code>if((typeof Ext.getCmp("cmp1") !== 'undefined') &amp;&amp; (typeof Ext.getCmp("cmp2") !== 'undefined')){
      Ext.getCmp("cmp1").setWidth(Ext.getCmp("cmp2").getWidth()-2);
      Ext.getCmp("cmp1").doLayout();
      }else{
           //Call self again in 3 sec once render
           //setTimeout("doLayoutofcustomPanel()", 3000);
      }
  </code></pre>