+ Start a Discussion
sunny522sunny522 

How to handle Subscript is invalid because list is empty Visualforce Error??

I have a query 

[Select id,name,(SELECT task.ActivityDate,task.Description,task.Subject FROM test__c.tasks) from test__c]; 

i am able to display test__c and task fields but if test__c do not have any task then visualforce is displaying 

Content cannot be displayed: Subscript is invalid because list is empty.how to handle this?

tggagnetggagne

Are you sure it's visualforce complaining and not a custom controller?

sunny522sunny522
yes.if i remove the task associated fields,then i didnot get error.