JavaNullPointer Exception on ArrayList Add Function : <p>Hope you are doing well</p>

<p>i am facing issue while adding object to ArrayList
i need your kind assistance in solving this problem
each time when i am going to add something to selectedContacts ArrayList i got nullPointerException</p>

<pre><code>ArrayList&lt;ContactInfo&gt; selectedContacts = new ArrayList&lt;&gt;();
    public ArrayList&lt;ContactInfo&gt; getSelectedContacts()
        {
            int i = 0;
            while (contacts.get(i).isCheck()==true)
            {
                ContactInfo info = contacts.get(i);
                if(info != null)
                    selectedContacts.add(info);
                i++;
            }
            return selectedContacts;
        }
</code></pre>

<p>ContactInfo.Java</p>

<pre><code>public class ContactInfo {
    String name;
    String number;
    String email;
    boolean check;

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public void setCheck(boolean check) {
        this.check = check;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setNumber(String number) {
        this.number = number;
    }

    public boolean isCheck() {
        return check;
    }

    public String getName() {
        return name;
    }

    public String getNumber() {
        return number;
    }

}
</code></pre>
