I Have the following apex code which is throwing a nullpointer exception on the line:
points = points + value;
List<JMG_ExternalSearch__c> searchList = [SELECT Id,LastModifiedDate,JMG_External_Search_Points__c,
(SELECT Id,JMG_ES_Points__c FROM New_applications__r)
FROM JMG_ExternalSearch__c WHERE ID IN: esIds];
for(JMG_ExternalSearch__c searchRec : searchList){
integer points = 0;
if(searchRec.New_applications__r.size() >0 ){
for(cxsrec__cxsNew_application__c Ja: searchRec.New_applications__r){
system.debug('Ja.JMG_ES_Points__c: ' + Ja.JMG_ES_Points__c);
integer value = (integer)Ja.JMG_ES_Points__c;
points = points + value;
}
} system.debug('points: ' + points);
searchRec.JMG_External_Search_Points__c = points;
}
update searchList;
What am I missing? Thanks in advance.