While using the following null check statement :
if (Loan.Existing_Loan_Details__r != null)
I get below error:
System.QueryException: Aggregate query has too many rows for direct assignment, use FOR loop
In this case,Loan is parent object and Existing_Loan__Details__r(28 records) is child object.I have used the sub queries to access Existing_Loan__Details__r child object along with other child objects of Loan sobject. The number of records are less than 200 even after considering all the child objects of Loan.Still getting the same error. How should I check null condition to avoid null pointer exception?