I get this error if LargestRevision returns null. ie., fields revision and quote link have no values. Why isn't the else part handling null values? Following is the code I tried.
if(quoteLink.Quote_Link__c!=null)
LargestRevision=[SELECT Revision_Number__c FROM OPP_QuoteLink__c WHERE Quote_Link__c=:quoteLink.Quote_Link__c ORDER BY Revision_Number__c DESC LIMIT 1];
if(LargestRevision.size()!=null){
clonedQuteLink.Revision_Number__c=LargestRevision.get(0).Revision_Number__c+1;
clonedQuteLink.Quote_Link__c = quoteLink.Quote_Link__c;
}
else
{
clonedQuteLink.Revision_Number__c=1;
clonedQuteLink.Quote_Link__c = quoteLink.Id;
}
Here
Revision_Number__c is a number field.
Quote_Link__c is a lookup field