Error when using zoho.crm.getRecordById and no record found

Error when using zoho.crm.getRecordById and no record found

I am trying to use the zoho crm api function zoho.crm.getRecordById but get an error when this function does not find a value.

How can i prevent this error?

  1. Error in executing Set Variable task. Unable to update template variable crmRecord. Error evaluating MAP expression :

The code I am using is as follows:

  1. crmRecord = zoho.crm.getRecordById("Leads", quote.Lead_ID.toLong());

Some background on my applications...
When a lead is created in crm it passes the lead ID to creator. 
The trouble I have is when the crm lead is converted the Lead ID no longer exists and then this error arises.

I think i need to be able to check if the  crmRecord is null or has a zero record count. Since i cant use count function here how can i solve this problem if im getting the error just by using the api?