So I have code along the lines of the following inside a managed package, and in one client org it's causing a null dereference exception.
double d = 100;
d *= (Global_Settings__c.GetOrgDefaults().Number_Field__c == null ? 1 : Global_Settings__c.GetOrgDefaults().Number_Field__c);
What's confusing me is that the documentation says GetOrgDefaults()
should return an empty object if no record exists (i.e. not null
) and in my experience that's always been the case. However, given the code above the only way I can be getting a null dereference is if GetOrgDefaults()
is returning null (the double var is known good).
So the question is whether GetOrgDefaults
is not supported on PE with hierarchical custom settings because of the lack of user profiles. Anybody have any idea?