diff --git a/src/Umbraco.Tests/Umbraco.Tests.csproj b/src/Umbraco.Tests/Umbraco.Tests.csproj
index 492783e0e8..4be38487bd 100644
--- a/src/Umbraco.Tests/Umbraco.Tests.csproj
+++ b/src/Umbraco.Tests/Umbraco.Tests.csproj
@@ -283,7 +283,7 @@
-
+
diff --git a/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/EditProfile.cshtml b/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/EditProfile.cshtml
index 8618e66162..eef8f5a911 100644
--- a/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/EditProfile.cshtml
+++ b/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/EditProfile.cshtml
@@ -20,7 +20,7 @@
@*NOTE: This RenderJsHere code should be put on your main template page where the rest of your script tags are placed*@
@Html.RenderJsHere()
-@if (Members.IsLoggedIn())
+@if (Members.IsLoggedIn() && profileModel != null)
{
if (success)
{
diff --git a/src/Umbraco.Web/Security/MembershipHelper.cs b/src/Umbraco.Web/Security/MembershipHelper.cs
index 2691f1d36c..abb2e90800 100644
--- a/src/Umbraco.Web/Security/MembershipHelper.cs
+++ b/src/Umbraco.Web/Security/MembershipHelper.cs
@@ -277,8 +277,15 @@ namespace Umbraco.Web.Security
{
var membershipUser = provider.GetCurrentUser();
var member = GetCurrentMember();
- //this shouldn't happen
- if (member == null) return null;
+ //this shouldn't happen but will if the member is deleted in the back office while the member is trying
+ // to use the front-end!
+ if (member == null)
+ {
+ //log them out since they've been removed
+ FormsAuthentication.SignOut();
+
+ return null;
+ }
var model = ProfileModel.CreateModel();
model.Name = member.Name;
@@ -417,8 +424,15 @@ namespace Umbraco.Web.Security
if (provider.IsUmbracoMembershipProvider())
{
var member = GetCurrentMember();
- //this shouldn't happen
- if (member == null) return model;
+ //this shouldn't happen but will if the member is deleted in the back office while the member is trying
+ // to use the front-end!
+ if (member == null)
+ {
+ //log them out since they've been removed
+ FormsAuthentication.SignOut();
+ model.IsLoggedIn = false;
+ return model;
+ }
model.Name = member.Name;
model.Username = member.Username;
model.Email = member.Email;
@@ -426,8 +440,15 @@ namespace Umbraco.Web.Security
else
{
var member = provider.GetCurrentUser();
- //this shouldn't happen
- if (member == null) return null;
+ //this shouldn't happen but will if the member is deleted in the back office while the member is trying
+ // to use the front-end!
+ if (member == null)
+ {
+ //log them out since they've been removed
+ FormsAuthentication.SignOut();
+ model.IsLoggedIn = false;
+ return model;
+ }
model.Name = member.UserName;
model.Username = member.UserName;
model.Email = member.Email;