diff --git a/DNN Platform/Library/Entities/Users/Profile/UserProfile.cs b/DNN Platform/Library/Entities/Users/Profile/UserProfile.cs index ce4a6f5b6a3..2b73a1d99a7 100644 --- a/DNN Platform/Library/Entities/Users/Profile/UserProfile.cs +++ b/DNN Platform/Library/Entities/Users/Profile/UserProfile.cs @@ -2,10 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information -// ReSharper disable CheckNamespace +// ReSharper disable once CheckNamespace namespace DotNetNuke.Entities.Users - -// ReSharper restore CheckNamespace { using System; using System.Globalization; @@ -18,6 +16,7 @@ namespace DotNetNuke.Entities.Users using DotNetNuke.Common.Utilities; using DotNetNuke.Entities.Portals; using DotNetNuke.Entities.Profile; + using DotNetNuke.Instrumentation; using DotNetNuke.Services.FileSystem; /// @@ -620,7 +619,7 @@ public ProfilePropertyDefinition GetProperty(string propName) /// /// Used mainly for custom profile properties, many default properties are already exposed in this class. /// - /// The name of the propoerty to retrieve. + /// The name of the property to retrieve. /// A string representing the property value. public string GetPropertyValue(string propName) { @@ -634,6 +633,12 @@ public string GetPropertyValue(string propName) { var controller = new ListController(); var dataType = controller.GetListEntryInfo("DataType", profileProp.DataType); + if (dataType == null) + { + LoggerSource.Instance.GetLogger(typeof(UserProfile)).ErrorFormat("Invalid data type {0} for profile property {1}", profileProp.DataType, profileProp.PropertyName); + return propValue; + } + if (dataType.Value == "Country" || dataType.Value == "Region") { propValue = this.GetListValue(dataType.Value, propValue);