"SetIcon" causing Runtime error with nullpointer exception

I was trying to set both Icon and text in Tab on a Tabbed Activity. Everything works fine but while I'm trying to set Icons there, it comes up with a Runtime (NullPointerException) error. Need to know the reason for this error and also a solution!

Here's the code :

public class MainActivity extends AppCompatActivity {

public SectionsPageAdapter mSectionsPageAdapter;
public ViewPager mViewPager;
public TabLayout IconLayout;

@Override
protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);


    IconLayout = findViewById(R.id.tabItem);

    mSectionsPageAdapter = new SectionsPageAdapter(getSupportFragmentManager());

    //Setup the ViewPager with the new sections adapter.
    mViewPager = findViewById(R.id.container);
    setUpViewPager(mViewPager);

    TabLayout tabLayout = findViewById(R.id.tabs);
    tabLayout.setupWithViewPager(mViewPager);


    Toolbar toolbar = findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    IconLayout.setupWithViewPager(mViewPager);
    setIconLayout();

}

public void setIconLayout(){
    IconLayout.getTabAt(0).setIcon(R.drawable.ic_launcher_background);
    IconLayout.getTabAt(1).setIcon(R.drawable.ic_launcher_background);
    IconLayout.getTabAt(2).setIcon(R.drawable.ic_launcher_background);
}

private void setUpViewPager(ViewPager viewPager){
    SectionsPageAdapter adapter = new SectionsPageAdapter(getSupportFragmentManager());
    adapter.addFragment(new CategoryFragment(),"Category");
    adapter.addFragment(new HomeFragment(),"Home");
    adapter.addFragment(new TrendingFragment(),"Trending");

    viewPager.setAdapter(adapter);
}

}

Warning : "SetIcon" may produce java.lang.nullPointerException.

Here's the Error(s) from logcat :

2018-10-12 00:30:27.160 4000-4000/com.example.a3dwallpaper2018 E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.a3dwallpaper2018, PID: 4000
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.a3dwallpaper2018/com.example.a3dwallpaper2018.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.design.widget.TabLayout.setupWithViewPager(android.support.v4.view.ViewPager)' on a null object reference
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2817)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
        at android.app.ActivityThread.-wrap11(Unknown Source:0)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
        at android.os.Handler.dispatchMessage(Handler.java:105)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6541)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
     Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.design.widget.TabLayout.setupWithViewPager(android.support.v4.view.ViewPager)' on a null object reference
        at com.example.a3dwallpaper2018.MainActivity.onCreate(MainActivity.java:42)
        at android.app.Activity.performCreate(Activity.java:6975)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1213)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2770)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892) 
        at android.app.ActivityThread.-wrap11(Unknown Source:0) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593) 
        at android.os.Handler.dispatchMessage(Handler.java:105) 
        at android.os.Looper.loop(Looper.java:164) 
        at android.app.ActivityThread.main(ActivityThread.java:6541) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)