function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sarath C RSarath C R 

Please help me out with this

error::::'System.NullPointerException: Attempt to de-reference a null object' 
Class.massUpdateLeadController.<init>: line 7, column 1

​Please check the following class

public with sharing class massUpdateLeadController { 
    public List<Lead> Leadlst;     
    list<Id> lstId = new List<id>();     
    public Lead lead{get;set;}
    public massUpdateLeadController(ApexPages.StandardController sc) {
             lead = (Lead)sc.getRecord();
             lstId = ApexPages.currentPage().getParameters().get('recs').split(',',-2);
             leadlst = [select id, Industry from Lead where Id In : lstId];    
              }
    public pagereference updateLeads(){
          for(Lead l: Leadlst){
                       l.Industry = lead.Industry;
                                }
          update Leadlst;
          pagereference pg = new pagereference('/00Q/o');
          return pg;
          }     
          public pagereference cancel(){
                   pagereference pg = new pagereference('/00Q/o');
                   return pg;     } 

}
James LoghryJames Loghry

Looks like the 'recs' parameter is not set in your URL.

You should add null checking around line 7.  For example:
 

lstId = String.isEmpty(ApexPages.currentPage().getParameters().get('recs')) ? null : ApexPages.currentPage().getParameters().get('recs').split(',',-2);
Sarath C RSarath C R
Thanks for replying James.