+ Start a Discussion
sieb4mesieb4me 

caused by: System.ListException: List index out of bounds: 0

Error:
Apex script unhandled exception by user/organization: 005A0000000PKLe/00DA0000000JUaR
 
Visualforce Page: /apex/StructuredResponse
 
Error seen when changing a picklist field value, which shows other fields on selection but instead it shows the error above
 
 
caused by: System.ListException: List index out of bounds: 0
 
Class.StructuredResponseExtensionController.setTemplateLanguageFromContact: line 41, column 1
Class.StructuredResponseExtensionController.<init>: line 36, column 1

CODE where it errors. - this code is on class used by VF page.


setTemplateLanguageFromContact();
  

   
   private void setTemplateLanguageFromContact() {
       try {
            String contactLanguage =  [select Contact.INFA_Language__c from Case where Id = :cas.Id limit 1][0].Contact.INFA_Language__c;
            cas.Structured_Response_Language__c = contactLanguage;
         }catch(DMLException dme) {
         } 
   }
BalajiRanganathanBalajiRanganathan
You might not be getting the value for cas.id and the SOQL might return empty result.