Skip to content

Commit

Permalink
make the code stronger for both classes
Browse files Browse the repository at this point in the history
  • Loading branch information
infofromca committed Apr 13, 2024
1 parent ac1accb commit 92c76a7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ public async Task OnResultExecutionAsync(ResultExecutingContext context, ResultE

foreach (var widget in widgets)
{
if(widget == null) continue;

var layer = widget.Layer != null && layers.TryGetValue(widget.Layer, out var widgetLayer) ? widgetLayer : null;

if (layer == null)
Expand All @@ -117,7 +119,7 @@ public async Task OnResultExecutionAsync(ResultExecutingContext context, ResultE
continue;
}

if (contentDefinitions.Any(c => c.Name == widget.ContentItem.ContentType))
if (widget.ContentItem != null && contentDefinitions.Any(c => c.Name == widget.ContentItem.ContentType))
{
var widgetContent = await _contentItemDisplayManager.BuildDisplayAsync(widget.ContentItem, updater);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ public override async Task<IDisplayResult> DisplayAsync(WidgetsListPart part, Bu
{
foreach (var widget in part.Widgets[zone])
{
if (widget == null) continue;

var layerMetadata = widget.As<WidgetMetadata>();

if (layerMetadata != null)
Expand Down

0 comments on commit 92c76a7

Please sign in to comment.