From 47c809885dcc14c248f74b256a4f89f0132caeec Mon Sep 17 00:00:00 2001 From: malik masis Date: Fri, 10 Jun 2022 14:56:19 +0300 Subject: [PATCH] Checked range of arrays --- .../Volo/CmsKit/Polls/ContentParser.cs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Polls/ContentParser.cs b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Polls/ContentParser.cs index 5bbd5a9b24..38c0737012 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Polls/ContentParser.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Polls/ContentParser.cs @@ -71,16 +71,19 @@ public class ContentParser : IContentParser, ITransientDependency { if (parsedList[i] == delimeter) { - var name = _options.WidgetConfigs.Where(p => p.Key == polls[k]).Select(p => p.Value.Name).FirstOrDefault(); - if (name is not null) + if (polls.Count > k) { - contentFragments.Add(new WidgetContentFragment(name) + var name = _options.WidgetConfigs.Where(p => p.Key == polls[k]).Select(p => p.Value.Name).FirstOrDefault(); + if (name is not null && pollNames.Count > k) { - Properties = + contentFragments.Add(new WidgetContentFragment(name) { - { "Name", pollNames[k]} - } - }); + Properties = + { + { "Name", pollNames[k]} + } + }); + } } k++; }