Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds null check for current httpcontext in ValueProviderConditionsCon… #2

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ Want to contribute to SFE? Great! This section will explain how to setup the pro
When adding new functionality to the codebase, please add a test-form in the sitecore content tree (/sitecore/Forms). Also, add a page of the template `/sitecore/templates/Project/FormsExtensionsTester/Pages/ContentPage` in the test-website, referencing the form containing the test of the functionality.

## Changelog 📜
### 4.1.1 (for Sitecore 10.3)
- Fix: Issue 143, add null check for current httpcontext in ValueProviderConditionsContext

### 4.1.0 (for Sitecore 10.3)
- Updated compatibility with SC10.3

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package >
<metadata>
<id>SitecoreFormsExtensions.Core</id>
<version>4.1.0</version>
<version>4.1.1</version>
<title>$title$</title>
<authors>Bart Verdonck</authors>
<owners>$author$</owners>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

[assembly: AssemblyTitle("SitecoreFormsExtentions.Core")]
[assembly: Guid("df75115a-6f76-41c6-b61f-3772e523e78e")]
[assembly: AssemblyVersion("4.1.0")]
[assembly: AssemblyVersion("4.1.1")]
[assembly: AssemblyCompany("Bart Verdonck")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyDescription("Sitecore Forms Extensions is a module to enrich the default Sitecore Forms module. This library does not intall the module, it only provides the classes and interfaces to extends on Sitecore Forms Extentions.")]
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,31 @@

namespace Feature.FormsExtensions.ValueProviderConditions
{
public class ValueProviderConditionsContext
public class ValueProviderConditionsContext
{
private const string ValueProviderConditionsMetKey = "ValueProviderConditionsMet";

public static bool ValueProviderConditionsMet
{
private const string ValueProviderConditionsMetKey = "ValueProviderConditionsMet";
get
{
if (HttpContext.Current?.Items == null)
return false;

public static bool ValueProviderConditionsMet
if (HttpContext.Current.Items.Contains(ValueProviderConditionsMetKey))
{
get
{
if (HttpContext.Current.Items.Contains(ValueProviderConditionsMetKey))
{
return (bool) HttpContext.Current.Items[ValueProviderConditionsMetKey];
}
return false;
}
set => HttpContext.Current.Items[ValueProviderConditionsMetKey] = value;
return (bool)HttpContext.Current.Items[ValueProviderConditionsMetKey];
}

return false;
}
set
{
if (HttpContext.Current?.Items == null)
return;

HttpContext.Current.Items[ValueProviderConditionsMetKey] = value;
}
}
}
}