title: TypeError: null is not an object (evaluating '*')
body: <p>For the below code:</p>
  
  <pre><code>var item = cartModel.getlist()[index];
  if((item.isDepo()) {
      // Some code
  } else if(!permission.hasPermissionToVoidSKU()) {
      // Some code
  } else if(item.sku.indexOf(mposConstants.RESTOCK_FEE_SKU) &gt; -1){
                  // Some code 
  }
  </code></pre>
  
  <p>I'm getting this error:</p>
  
  <blockquote>
    <p>TypeError: null is not an object (evaluating 'item.sku.indexOf')</p>
  </blockquote>
  
  <p>If item object is null, the error is something different (see below). <strong>In what scenario will this error be thrown?</strong></p>
  
  <p><em>Update:</em></p>
  
  <p>If <code>item.sku</code> is null, the error is:</p>
  
  <blockquote>
    <p>[FATAL] [] [-] ["TypeError: Cannot read property 'indexOf' of null</p>
  </blockquote>
  
  <p>If <code>item</code> is null, the error is:</p>
  
  <blockquote>
    <p>[FATAL] [] [-] ["TypeError: Cannot read property 'isDepo' of null</p>
  </blockquote>