Skip to content

Commit

Permalink
Improve robustness of attribute lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
donker authored and bdukes committed Oct 6, 2020
1 parent 074a865 commit ed13b35
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,7 @@
<HintPath>..\..\Packages\Microsoft.AspNet.WebApi.WebHost.5.2.3\lib\net45\System.Web.Http.WebHost.dll</HintPath>
</Reference>
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<AdditionalFiles Include="..\..\stylecop.json">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ namespace Dnn.PersonaBar.Servers.Services

using Dnn.PersonaBar.Library;
using Dnn.PersonaBar.Library.Attributes;
using Dnn.PersonaBar.Servers.Services.Dto;
using Dnn.PersonaBar.Servers.Services.Dto;
using DotNetNuke.Collections;
using DotNetNuke.Common.Utilities;
using DotNetNuke.Entities.Controllers;
using DotNetNuke.Entities.Host;
Expand Down Expand Up @@ -51,7 +52,7 @@ public HttpResponseMessage GetSmtpSettings()
smtpPassword = PortalController.GetEncryptedString("SMTPPassword", portalId, Config.GetDecryptionkey())
},
portalName = PortalSettings.Current.PortalName,
hideCoreSettings = bool.Parse(ProviderConfiguration.GetProviderConfiguration("mail").GetDefaultProvider().Attributes["hideCoreSettings"]),
hideCoreSettings = ProviderConfiguration.GetProviderConfiguration("mail").GetDefaultProvider().Attributes.GetValueOrDefault("hideCoreSettings", false),
};
return this.Request.CreateResponse(HttpStatusCode.OK, smtpSettings);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ namespace Dnn.PersonaBar.Servers.Services

using Dnn.PersonaBar.Library;
using Dnn.PersonaBar.Library.Attributes;
using Dnn.PersonaBar.Servers.Services.Dto;
using Dnn.PersonaBar.Servers.Services.Dto;
using DotNetNuke.Collections;
using DotNetNuke.Common.Utilities;
using DotNetNuke.Entities.Controllers;
using DotNetNuke.Entities.Host;
Expand Down Expand Up @@ -61,7 +62,7 @@ public HttpResponseMessage GetSmtpSettings()
smtpPassword = PortalController.GetEncryptedString("SMTPPassword", portalId, Config.GetDecryptionkey())
},
portalName = PortalSettings.Current.PortalName,
hideCoreSettings = bool.Parse(ProviderConfiguration.GetProviderConfiguration("mail").GetDefaultProvider().Attributes["hideCoreSettings"]),
hideCoreSettings = ProviderConfiguration.GetProviderConfiguration("mail").GetDefaultProvider().Attributes.GetValueOrDefault("hideCoreSettings", false),
};
return this.Request.CreateResponse(HttpStatusCode.OK, smtpSettings);
}
Expand Down

0 comments on commit ed13b35

Please sign in to comment.