function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

NullPointer Exception in Test Class

Hello - could any one help me with this problem in my test class?
Test class is having an issue with this statement:
if (String.isNotBlank(AcctId)){
     rec =  [Select Id, Name from Acct__c  where Id1__c =: decimal.valueOf(Id_in) and AcctId__c =: AcctId ];

Error is: System.NullPointerException: Argument cannot be null 
SOQL will not be run if the AcctId is blank or null.
Would you know how I could fix?
Thank you! I figured out the issue. decimal.valueOf(Id_in) is causing the issue. I need to check for null first an convert it to a decimal if the value is not null. The SOQL has been updated to use the decimal field in my where clause.