Activity › Forums › Salesforce® Discussions › how to fix list index out of bounds in Apex ? Salesforce® Discussions how to fix list index out of bounds in Apex ? Posted by Ayush on June 30, 2020 at 12:45 PM how to fix list index out of bounds in Apex ? Kirandeep replied 5 years, 11 months ago 3 Members · 2 Replies 2 Replies Shweta Member June 30, 2020 at 1:52 PM It occurs when we are trying to access the value by index and the query is unable to fetch any records. We can add a not null check to each of ‘if’ statements or alternatively use the native isEmpty method. [adinserter block='9'] Kirandeep Member June 30, 2020 at 2:48 PM Hi Ayush, System.ListException: List index out of bounds: This Exception occurs when we try to access an index that’s not in the List. Log In to reply. Public All Members My Connections Only Me PublicAll MembersMy ConnectionsOnly Me Public All Members My Connections Only Me