Skip to content

Commit 4ad786c

Browse files
committed
Make sure method return non-null values
1 parent a64b4a2 commit 4ad786c

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

sfdx-source/apex-common/main/classes/fflib_SObjects.cls

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,13 @@ public virtual class fflib_SObjects
161161
* @return Return a set with all the Id values of the given field
162162
*/
163163
@TestVisible
164-
protected Set<Id> getIdFieldValues(Schema.SObjectField field)
164+
protected virtual Set<Id> getIdFieldValues(Schema.SObjectField field)
165165
{
166166
Set<Id> result = new Set<Id>();
167167
for (SObject record : getRecords())
168168
{
169+
if (record.get(field) == null) continue;
170+
169171
result.add((Id) record.get(field));
170172
}
171173
return result;
@@ -177,11 +179,13 @@ public virtual class fflib_SObjects
177179
* @return Return a set with all the String values of the given field
178180
*/
179181
@TestVisible
180-
protected Set<String> getStringFieldValues(Schema.SObjectField field)
182+
protected virtual Set<String> getStringFieldValues(Schema.SObjectField field)
181183
{
182184
Set<String> result = new Set<String>();
183185
for (SObject record : getRecords())
184186
{
187+
if (record.get(field) == null) continue;
188+
185189
result.add((String) record.get(field));
186190
}
187191
return result;

0 commit comments

Comments
 (0)