Questions tagged [null-pointer]

The tag has no usage guidance, but it has a tag wiki.

Filter by
Sorted by
Tagged with
-3
votes
1answer
44 views

How to Resolve code coverage issue [closed]

I am getting a NullPoint Exception on test class, any help will be appreciated. My API Class:- @RestResource (urlmapping = '/UpdateBill/*') global without sharing class ApiUpdateClass{ ...
-2
votes
0answers
42 views

How to Solve NullPoint Exception in Test class, the error is System.NullPointerException: Attempt to de-reference a null object

Main Class:- @RestResource (urlmapping = '/UpdateBill/*') global without sharing class ApiUpdateClass { @HttpPatch global static void updateBill(){ RestContext.response.addHeader('...
0
votes
0answers
15 views

Error with ContentDocumentLink insert null pointer

I am trying to create a salesforce file and link to it.But when i run the code i get an error BeforeInsert caused by: System.NullPointerException: Attempt to de-reference a null object on the line ...
0
votes
2answers
65 views

Null pointer exception inside for Loop

Here is the code: for(Requests curRequest : requestList){ if (curRequest.varSRProduct!= null ){ for(SObject so : curRequest.varSRProduct){ //code } } ...
0
votes
1answer
59 views

Null pointer exception using null safe navigation operator

Following scenario throws nullptr exception inside if condition block !sample?.SomeField__c: MyObject__c sample = null; if (!sample?.SomeField__c) { ... } Why is that? Shouldn't that be evaluated ...
0
votes
1answer
994 views

Test class throwing argument cannot be null error

I am seeing System.NullPointerException: Argument cannot be null in my test class Below is the controller method that i am trying to cover : public void Synchsongmethod() { system.debug(...
0
votes
2answers
49 views

Need help with a mystery null pointer exception

I'm getting Null Pointer Exception from some recent code changes and I can't figure out where it's coming from. I've put ** around the new code. Any help would be appreciated! System.DmlException: ...
0
votes
1answer
26 views

Deploy error: List has no rows for assignment to SObject and INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY

I am trying to deploy a destructive package, but I am receiving the following errors in test classes: System.DmlException: Insert failed. First exception on row 0; first error: ...
-1
votes
1answer
44 views

Handle Null Pointer exception in better way while assigning value

In this example had shown only 2 fields, Need to handle many fields. For checking, null pointer exception for each fields are really tedious Task. Any Easy way to do this. Apex Class: public class ...
-1
votes
1answer
33 views

How to fix System.NullPointerException: Attempt to de-reference a null object in a Batch

I have a batch and I can't figure out how to fix System.NullPointerException error going through my debug log my kes variable is null for (Known_Error_Subscription__c kes : scope) { kes....
0
votes
1answer
27 views

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

I am unable to fix the error System.NullPointerException: Attempt to de-reference a null object on my trigger. Could someone help? Thanks trigger Knowledge_kavKnownErrorSubscription on Knowledge__kav (...
0
votes
2answers
201 views

How to handle null keys in JSON response?

I have a json response class like this: public with sharing class Response { public Person person; public class Person { public PersonData personData = new PersonData (); ...
0
votes
1answer
207 views

Error when generating a JAR with Enterprise WSDL

I have generate Enterprise WSDL file and downloaded to my local machine. Now I'm trying to generate the jar file with following command. java -classpath .\..\..\..\..\..\.m2\repository\com\force\api\...
0
votes
1answer
327 views

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

I'm trying to use an Apex trigger to associate Account.Name to a Contact from a community form. Here is my trigger, trigger ContactBeforeInsert on Contact (before insert, after insert) { String ...
2
votes
1answer
91 views

Attempt to de-reference a null object when using alternative to getGlobalDescribe

In the following code String myString = 'Account'; SObjectType sObjType = ((SObject) Type.forName(myString).newInstance()).getSObjectType(); When myString = a object name does not exist i get a ...
0
votes
1answer
23 views

I tried coding for inserting candidate using custom controller [closed]

public class InsertCandidatecontroller { public Candidate__c can {get; set;} public InsertCandidatecontroller(ApexPages.StandardController controller) { } // Initialization of ...
0
votes
1answer
63 views

Getting a null pointer exception

I was trying to fix a null pointer exception here if(com.Employee__c != null && (mapEmployees.containskey(com.Employee__c) == null || (mapEmployees.containskey(com.Employee__c) != null &&...
0
votes
1answer
129 views

System.NullPointerException: Argument cannot be null error in test class

Below is my Test Class and I am getting the error : System.NullPointerException: Attempt to de-reference a null object error on line 23 . @isTest public class ShowRoom_VisitController_Test { //...
3
votes
1answer
89 views

NullPointerException BeforeInsert on Lead Trigger

I am pretty new to writing custom code in SF and would appreciate any help. I have a trigger on Leads to update Status to "Contacted" when a task on that Lead is "Completed". I found this in a ...
0
votes
1answer
2k views

Apex Specialist Superbadge Null Reference on Challenge 4

Been spinning my wheels on this for awhile. Frustrating thing about these Trailheads is no point of reference for what tests are failing on Salesforce's end that might be producing this error. Here ...
0
votes
1answer
328 views

Error deserializing json array nullpointer exception

I receive this json through a request {"pay_CCIban":"XXX", "pay_bic":"YYY", "pay_names[]":["name one","name two"], "pay_extid":"extId"} I'm trying to deserialize it with this class global class ...
0
votes
1answer
327 views

Argument cannot be null in Rest Apex class

I am trying to send data from salesforce to external system and have written web service but even after properly encoding every parameter, i am getting argument cannot be null due to which data is not ...
-1
votes
1answer
31 views

NPE for the case object before insert

I am trying to write a method that goes through and creates the proper local timezone on the case object versus dates that could be done via the user since we might have different time zones for them ...
3
votes
2answers
1k views

Comparision directly on null value safe?

So many times, we do a null check of a field value and then compare them boolean checkAmountGreaterThan10k(Opportunity record){ if(record.Amount!=null){ return record.Amount > 10000; ...
-1
votes
1answer
69 views

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

When I am trying to access the Opportunity_Item_ID__c: 00k0I00000phfpdQAC in the browser it says "Data Not Available" "The data you were trying to access could not be found. It may be due to another ...
2
votes
2answers
119 views

Unable to handle Attempt to de-reference a null object with map

I'm working on after update trigger. And it's throwing an exception after I'm checking null values too. i don't have any idea why it's public void AfterUpdate(Map<Id, SObject> newItems, Map&...
1
vote
2answers
52 views

Attempt to de-reference a null object error while accessing field in the Account object

I have a Quote__c object which has a field named FieldTpReferAccount__c which refers to Account. The Account object has a custom field named FieldInAccount__c. I need to update FieldInAccount__c in ...
1
vote
2answers
95 views

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

trigger UpdateApplicationStatusToEnrolled on vlocity_ins__Application__c (before update ) { Map <string,List<vlocity_ins__Application__c>> strMap = new Map <string,List<...
0
votes
1answer
60 views

System.NullPointerException Question (Basic)

I am new in coding. Currently, working on a nullpointerexception challenge on Apex. Error: WarrantySummary: execution of BeforeInsert caused by: System.NullPointerException: Attempt to de-reference ...
0
votes
2answers
1k views

Attempt to de-reference a null object - list get set

I try to add objects from 'accbetween' to 'idlist' (see the code below): public class SearchTestApex { public list <Fund__c> idlist {get;set;} public list <Fund__c> accbetween =...
0
votes
2answers
150 views

How to cater opportunity insertion in my TEST class

I have a method in APEX class that does variety of checks via If else conditions with some SOQL statements. I created test data(Accounts, custom object records) to test the SOQL statements and it ...
3
votes
4answers
2k views

Test method fails with “Attempt to de-reference a null object” Trying to use 2 record types of contact

In a test class, I need to have 2 contacts with different record types. Contact Record Types: Client_Only and Candidate. Account Contact is Client only, and Applicant is Candidate. Line 8 is ...
0
votes
1answer
568 views

How to resolve Attempt to de-reference a null object in Apex Controller

I am trying to bind my map value to wrapper class in apex controller . I am getting System.NullPointerException: Attempt to de-reference a null object. I couldn't understand where I am going wrong. ...
2
votes
1answer
377 views

Is there any way to make an Apex method parameter lazy?

Let's say I want to call a method like: doSomething(a.b.c.d.e.f()); I know that this might be an expensive operation and a, a.b, a.b.c, a.b.c.d, and a.b.c.d.e might all be null, however I would ...
1
vote
3answers
306 views

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

I keep getting a null pointer exception error as follows : System.NullPointerException: Attempt to de-reference a null object Stack Trace: Class.ColloTest_utoStudentIDTrigger....
4
votes
1answer
3k views

Apex `if (Boolean) `. Null exception virtually renders this check useless and unsafe

Being that an if (booleanVariable) check, where booleanVariable is null, throws a NullPointerException, it would seem that this check is unsafe. If so why would Apex allow it? This is especially true ...
0
votes
1answer
73 views

bluewolf-beyond/selector attempt to de-reference a null object

Our org uses a mix of a variety of open source packages including bluewolf-beyond/selector This is a nifty package that allows construction of sobject list filters using a builder pattern that is ...
3
votes
4answers
2k views

|FATAL_ERROR|System.NullPointerException: Attempt to de-reference a null object on my Apex Trigger

I'm kind of new in Apex development and I'm writing a before insert, before update trigger to a custom object that is going to be upserted through an API integration. Is very basic code but I don't ...
-1
votes
1answer
51 views

Help Me Solve A Null Pointer

I am trying to refactor some code. Right now I have a trigger calling lots of methods. And I would like to to have it call on master method. Right now I am getting a null pointer exception. And I don'...
0
votes
1answer
156 views

Attempt to de-reference null object (Custom File Import)

The requirement is to import a tab separated text file and updated the records matching with some statuses then display success to for failure with the list of records. I wrote the following VF and ...
-3
votes
2answers
403 views

Null pointer Exception in Apex controller

I am getting "FATAL_ERROR|System.NullPointerException: Attempt to de-reference a null object" in Apex controller when i click on update link pop up. Its showing in query with " ulstAsset ".I am newbie ...
-1
votes
1answer
927 views

Test Class for Trigger Null Pointer Exception

I am new to apex. Getting this error System.DmlException: Upsert failed. First exception on row 0 with id aBfn000000062BMCAY; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, OP_DeferralTrigger: ...
0
votes
2answers
122 views

System.NullPointerException: Attempt to de-reference a null object Class.CollectionMaster.getCollectionMaster: line 9, column 1

@RestResource(urlMapping='/CollectionMaster/*') global with sharing class CollectionMaster{ @HttpPOST global static CollectionWrapper getCollectionMaster(String userName){ list<...
0
votes
1answer
43 views

Attempt To De-reference a Null Object on a Before Trigger [duplicate]

I am trying to a write what should be a pretty simple trigger to compare an old score with a new score and increment a variable based on the difference. The default field values are set to 0. I ...
0
votes
1answer
374 views

Null pointer exception when using {get; set;}

I'm trying to build a custom VF quick action on the Case object that allows users to update checkboxes for case fields and also lets them add some comments that will later be posted to chatter, but ...
0
votes
2answers
31 views

how to add all child in map as a list in trigger handler?

On Entity__c object on that have Event as a related list. i want when i change the owner of the Entity then Owner of the Event also get change. for this i write the trigger on after update.but from UI ...
0
votes
1answer
410 views

@future Attempt to de-reference null object

The business requirement is to have a lookup relation ship between a Contract and Opportunity. A field on the opportunity must get the SUM of a custom field on the Contracts which belong to the ...
0
votes
1answer
462 views

System.NullPointerException: Attempt to de-reference a null object: () and Querying account hierarchy

I am currently developing the code that will update al the children accounts related to this parent account if this parent account gets 's updated.  gets updated.  I have two questions: What could ...
1
vote
0answers
248 views

How can the Describe for a Field of getPopulatedFieldsAsMap() be null

I'm doing a CRUD check on Field level, since under some weird circumstances our customers don't have update rights on Record level, but only on fields (it's a guest license). So in addition to the ...