Skip to content

Commit

Permalink
- Fix "key not present" exception in LocationFieldType to handle situ…
Browse files Browse the repository at this point in the history
…ations where the given configurationValues are missing certain keys. (ref 1549917 AttributeEditor.cs line 2070)
  • Loading branch information
nairdo committed Oct 13, 2023
1 parent bc671f0 commit 367788a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Rock/Field/Types/LocationFieldType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -380,10 +380,11 @@ public override Control EditControl( Dictionary<string, ConfigurationValue> conf
LocationPickerMode allowedPickerModes = LocationPickerMode.All;

// Get the selected current picker mode, use address if there isn't one specified. This is the mode the picker will start with unless the location specifies a different location type.
var currentPickerMode = configurationValues[CURRENT_PICKER_MODE].Value.ConvertToEnumOrNull<LocationPickerMode>() ?? LocationPickerMode.Address;

var currentPickerMode = configurationValues.ContainsKey( CURRENT_PICKER_MODE ) ? configurationValues[CURRENT_PICKER_MODE].Value.ConvertToEnumOrNull<LocationPickerMode>() ?? LocationPickerMode.Address : LocationPickerMode.Address;

string[] allowedPickerModesConfig = null;
if ( configurationValues[ALLOWED_PICKER_MODES].Value.IsNotNullOrWhiteSpace() )
if ( configurationValues.ContainsKey(ALLOWED_PICKER_MODES) && configurationValues[ALLOWED_PICKER_MODES].Value.IsNotNullOrWhiteSpace() )
{
allowedPickerModesConfig = configurationValues[ALLOWED_PICKER_MODES].Value.Split( ',' );
}
Expand Down

0 comments on commit 367788a

Please sign in to comment.