Skip to content

Commit 3e2c2e9

Browse files
committed
Merge pull request apex-enterprise-patterns#54 from tfuda/master
Add protection against trying to iterate over a null list
2 parents c797069 + 2ec3ddd commit 3e2c2e9

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

fflib/src/classes/fflib_SObjectSelector.cls

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -365,8 +365,9 @@ public abstract with sharing class fflib_SObjectSelector
365365
{
366366
// select the Selector fields and Fieldsets and set order
367367
queryFactory.selectFields(new Set<SObjectField>(getSObjectFieldList()));
368-
if(m_includeFieldSetFields)
369-
for(Schema.FieldSet fieldSet : getSObjectFieldSetList())
368+
List<Schema.FieldSet> fieldSetList = getSObjectFieldSetList();
369+
if(m_includeFieldSetFields && fieldSetList != null)
370+
for(Schema.FieldSet fieldSet : fieldSetList)
370371
queryFactory.selectFieldSet(fieldSet);
371372

372373
// Automatically select the CurrencyIsoCode for MC orgs (unless the object is a known exception to the rule)
@@ -394,4 +395,4 @@ public abstract with sharing class fflib_SObjectSelector
394395

395396
return queryFactory;
396397
}
397-
}
398+
}

0 commit comments

Comments
 (0)