Skip to main content
4 of 4
improved formatting
highfive
  • 6.3k
  • 3
  • 32
  • 58

Attempt to de-reference a null object

Can anyone please help me with the code below and why I am getting a null exception

public with sharing class activitiesdashboard {
    public list<Transport__c> activities {get; set;}
    public List<Trip_Activity__c> internalActivities {get; set;}
    public set<Id> actIds;
    public timeZone tz {get;set;}
    public string location {get;set;}
    public datetime refreshDate {get;set;}
    public Id taId;
    public List<Id> IdList;
    
    public activitiesdashboard() {
        tz = UserInfo.getTimeZone();
        location = apexpages.currentPage().getparameters().get('Site');
        activitydetails(); 
        internalActivityDetails();
    } 

    public void internalActivityDetails(){
        //retrieve the data required
        string recordtypecontains = '%'+location+'%';
        internalActivities = [select Id,trip__r.Group_Name__c,trip__r.Group_SYCO_ID__c,Patron_ID__c,Patron_Name_E__c,Activity_Type__c,Car__c,
                   start_time__c,pax__c,venue__c,pickup_time__c,end_time__c,Host__r.name,trip__r.Patron_Type__c
                      from Trip_Activity__c where recordtype.name LIKE :recordtypecontains 
                      order by start_time__c asc limit 10];
          for(integer i=0;i < internalActivities.size();i++)
           {
            taId =   internalActivities[i].id;  
            actIds.add(taId);
           }
   }
}
user27749
  • 494
  • 1
  • 13
  • 26