I'm using an <apex:selectCheckboxes>
element in a VF page, with the options coming from this controller method:
public List<SelectOption> GetTemplateOptions()
{
List<SelectOption> options = new List<SelectOption>();
if(templates == null)
{
templates = new Map<Id, Template__c>();
for(Template__c template : [select Id, Name from Template__c where RecordType.DeveloperName = 'template'])
{
/* THE_BORK */
templates.Put(template.Id, template);
}
}
for(Template__c template : templates.Values())
{
/* THE_LINE */
options.Add(new SelectOption(template.Id, template.Name));
}
return options;
}
I'm collecting the results in an initialised list of strings and it's all fine and dandy. However, if I move the line marked THE_LINE
and put it where it says THE_BORK
, the system is throwing an internal server error when calling an action on the page.
I've been unable to reproduce in a developer org and obviously I've found a work around, but can anyone see what's wrong here because I can't work it out (maybe I've been looking at it for too long).