+ Start a Discussion
Sarath C RSarath C R 

System.NullPointerException: Attempt to de-reference a null object

Anyone please tell me what this means. I've created an apex class and I'm trying to access in VF. It throws an error like the above. 

Please help me out. I'm new to apex
Best Answer chosen by Sarath C R
Sumitkumar_ShingaviSumitkumar_Shingavi
There are below possiblities:
1. You might be referencing/iterating a variable/list which is just decleared and not defined/initialized
2. There might be cross object field which are referenced in output tags which have null value like blank lookup
3. Your DML action might be happening on some blank/null variable/list

All Answers

Deepak Kumar ShyoranDeepak Kumar Shyoran
You can use the debug log to trace this email exception. This usually occur when you tried to get some field or property of a null object. 
SonamSonam (Salesforce Developers) 
This means you have used a property which might have not been initialized with a value and you haven't checked it if its NULL:https://help.salesforce.com/HTViewSolution?id=000063739&language=en_US

 
Sumitkumar_ShingaviSumitkumar_Shingavi
There are below possiblities:
1. You might be referencing/iterating a variable/list which is just decleared and not defined/initialized
2. There might be cross object field which are referenced in output tags which have null value like blank lookup
3. Your DML action might be happening on some blank/null variable/list
This was selected as the best answer
Sarath C RSarath C R
Thanks For helping me out.
Sarath C RSarath C R
Thanks For helping me out.
Sarath C RSarath C R
Thanks For helping me out.
Sumitkumar_ShingaviSumitkumar_Shingavi
You can mark that comment as solution then!