+ Start a Discussion
c_r_carvalhoc_r_carvalho 

Attempty to de-reference a null object

Hi, 

I have a class with a static variable and i'm trying to access this variable from a trigger and a receive this error.
But this error happens in production environment only.

Someone tell me why?

Example class:

public class CustomClass{
    public static boolean run = false;
    /*

     CODE HERE
    */
}


Example trigger:

trigger CustomObject on CustomObject__c(before insert, before update){
  if( CustomClass.run ) return;
  
  //CODE HERE
}


Thank you!
Navee RahulNavee Rahul

Hello carvalho,

the sobject or any variable you use to Insert or Update is empty. and thats why u receiving the error.

Thanks
D Naveen Rahul.
Vishal Negandhi 16Vishal Negandhi 16
What type of variable is this? Can you share the line where this variable is defined so that we get a better idea of what's wrong here.