Skip to content

Commit

Permalink
Fix loading GlobalSearch settings
Browse files Browse the repository at this point in the history
Added a guard clause for empty or null state. Now returns default values similar to other converters rather than causing an exception.
  • Loading branch information
t0mburton authored May 19, 2017
1 parent 602396b commit 8b3a485
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ private static class Structure

public SearchState[] Convert(State state)
{
if (state == null || state == State.Empty)
return GetDefaultValue();

var doc = XDocument.Parse(state.Value);
var root = doc.Element(Structure.Root);

Expand Down Expand Up @@ -109,4 +112,4 @@ public SearchState[] GetDefaultValue()
return Enumerable.Empty<SearchState>().ToArray();
}
}
}
}

0 comments on commit 8b3a485

Please sign in to comment.