title: How to fix method invocation 'setIcon' may produce 'java.lang.NullPointerException'
body: <p>How to fix </p>
  
  <blockquote>
    <p>method invocation <code>setIcon</code> may produce <code>java.lang.NullPointerException</code>?</p>
  </blockquote>
  
  <pre><code>private void setupTabIcons() {
      tabLayout.getTabAt(0).setIcon(tabIcons[0]);
      tabLayout.getTabAt(1).setIcon(tabIcons[1]); 
      tabLayout.getTabAt(2).setIcon(tabIcons[2]);
  } 
  </code></pre>
  
  <p>I'm getting this message when setting icons to a tab layout.</p>