+ Start a Discussion

Attempty to de-reference a null object


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;


Example trigger:

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

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.

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.