• Tanishq Shrivastava
  • NEWBIE
  • 0 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
i am getting the following error while checking the challenge
"Challenge Not yet complete... here's what's wrong: 
There was an unexpected error in your org which is preventing this assessment check from completing: System.NullPointerException: Attempt to de-reference a null object"
below is my code:
public class AccountHandler{
    
    public static Account insertNewAccount(String strName)
    {
        if(strName!=null)
        {
            
       
        Account acc=new Account(Name=strName);
        try
        {
            insert acc;
            return acc;
        }
        catch(DmlException e)
        {
            System.debug('Dml exception has occured' +e.getMessage());
            return (null);
        }
        }
        else
        {
            return null;
        }
    }
}