Questions tagged [null-pointer]

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

Filter by
Sorted by
Tagged with
-1
votes
1answer
12 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 ...
0
votes
1answer
65 views

Getting null pointer exception on populating map of map data

I am writing trigger to update an order line item of order related to an Account when an invoice line item is inserted corresponding to that order line item. Problem is whenever a loop is iterating ...
2
votes
2answers
26 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
53 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 ...
1
vote
2answers
45 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
29 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
72 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
28 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
108 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
37 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 ...
1
vote
1answer
21 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
239 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
76 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....
0
votes
0answers
41 views

Formula field in a Predefined Field Value (Email)

I have a record, namely Quote, which has a lookup relationship with Contact. Now, I'm creating an Email tab under the Activity, and I want the fields (To, From, Subject, etc..) to be auto-populated. ...
3
votes
1answer
338 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
40 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
744 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
45 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
58 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 ...
-2
votes
2answers
100 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
260 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
41 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
27 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
123 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
212 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
236 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
142 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 ...
0
votes
2answers
35 views

System.NullPointerException: Attempt to de-reference a null object(about feeditem object)

I'm trying to add an action on Visualforce Page which enable end users to post messages on a case. But when I click the button, I get an error like: System.NullPointerException: Attempt to de-...
1
vote
1answer
217 views

NullPointerException: Attempt to de-reference a null object in a batchclass

I have this batchclass with which I want to update some checkboxes on account with the values of related assets checkbox values. When running the class I get an System.NullPointerException: Attempt to ...
0
votes
1answer
58 views

Issue with mapping the fields when there is an apex webservice xml response (Revised with new errors)

Apex call out has an xml response.How can I map the fields in Salesforce to the response I receieved. I could map the fields like clean etc. But how could I map fields like make,model, year relatively....
0
votes
1answer
153 views

Error updating custom Salesforce object using Talend ETL - Status Code: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY

I am trying to update the name of one of the Salesforce Custom Objects, and using Talend Data Integration tool for the same. The action on the salesforce Object is 'Update' and I only have two columns ...
-4
votes
1answer
181 views

Why do I get a NullPointerException?

The below code throws a NullPointerException at this line: WClass W = new WClass(con); WC.add(W); Here is the complete code: public class WrapperClassExample{ public List<WClass> WC{get;set;...
1
vote
2answers
61 views

Apex class in trigger populates lookup based on string input

I am writing a trigger on my Case object to run (before insert). I am receiving the following error: System.DmlException: Insert failed. First exception on row 0; first error: ...
0
votes
1answer
25 views

Null pointer exception on bulk update but working when I update manually via UI

I'm running a batch update on tasks and my task trigger handler is throwing a null pointer exception error. If I go through and update the tasks individually, I don't have any issues with them. If I ...
-3
votes
2answers
48 views

Null Pointer Exception on line 15,18 and 22 [closed]

trigger RollUpSummaryTrigger on Contact(after insert) { Set < id > accIdList = new Set < id > (); for (Contact con: Trigger.new) { accIdList.add(con.accountid); } List < account ...
0
votes
1answer
42 views

Getting this error after running my test class “System.NullPointerException: Attempt to de-reference a null object”

I'm currently modifying a test class made by someone because its getting this error. The part at which the error shows up is at the If condition. I'm not sure why it gives that error at that part ...
0
votes
1answer
285 views

execution of BeforeUpdate caused by: System.NullPointerException: [closed]

Attempt to de-reference a null object ()
1
vote
1answer
72 views

Unexpected null reference - how can this happen?

I have code in a task trigger handler that looks to see if the whoid is a contact, and if so, set a pointer in the Task object to a field in the contact. So the trigger does this: - loop through the ...
0
votes
1answer
181 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(...
3
votes
2answers
845 views

In this code, where is the attempt to de-reference a null object?

I've got some simple code and I'm wondering if someone can help me understand why it would result in the "Attempt to de-reference a null object" error? This is part of a custom controller that I'm ...
0
votes
1answer
312 views

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

Having an issue parsing my json using Apex when the value is null. My Json2Apex is being returned like so. [object1=cls_object:[amount=11000, amount_refunded=0, application=null, application_fee=...
1
vote
1answer
416 views

Try/Catch for Attempt to Dereference Null Object

Is there a way I can test with an IF statement for a null object. Using an IF (obj==null) throws the error. How can I account for these? With SOQL, I use a list and check the number. However, the ...
2
votes
1answer
73 views

Null Pointer if sObjectType isn't Case

I have the apex trigger below that is meant to check the WhatId on a new Task if the WhatId belongs to a case. The trigger then populates fields on the related Case for ActivityDate and Task Type. ...
0
votes
1answer
558 views

Test Class Error Message [closed]

I have a test class for a custom Visualforce page controller and I am getting the following error message: Error Message System.NullPointerException: Attempt to de-reference a null object Stack ...
3
votes
1answer
569 views

Issue with Invocable Method to Call Queueable

Ok, I'm officially confused. I've written some code to attempt to populate a Campaign lookup field on Opportunity based on some logic. The basic flow is Process Builder (so the client can ...
1
vote
1answer
162 views

Attempt to dereference null object error because emailTextBody is in fact null

I have an email service with Apex that drives a class reservations system that reads in a keyword from and email body and will update a record if the sender is coming or not. I will get an "Attempt ...
1
vote
1answer
33 views

Error when updating a custom field in a custom object - Attempt to de-reference a null object Error

I am trying to update a field in a custom object and I have stripped back my code to the bare minimum. I am getting this error on submission when I click the save button. How do I fix it? System....
0
votes
2answers
25 views

Map not getting populated

I have below code where the Map is not getting populated and throws Null Pointer error. System.NullPointerException: Attempt to de-reference a null object Code: for(Business_Plan_abv__c obj : [...
0
votes
1answer
45 views

Apex Trigger lookup that contains 'xyz' - NullPointerException

first post so apologies if there's some issues. I'm looking to build an Apex trigger that looks up an Account name that contains "DUNNES" in the title (among other rules), and execute an email class. ...