Skip to content

Commit 53bf0fe

Browse files
authored
Merge pull request #1065 from yileicn/master
optimize CheckArgType
2 parents 1672374 + ced3883 commit 53bf0fe

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationStateService.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -419,12 +419,10 @@ private bool CheckArgType(string name, string value)
419419
if (AgentService.AgentParameterTypes.IsNullOrEmpty())
420420
return true;
421421

422-
var agentTypes = AgentService.AgentParameterTypes
423-
.Where(p => p.Value != null)
424-
.SelectMany(p => p.Value)
425-
.ToList();
422+
if (!AgentService.AgentParameterTypes.TryGetValue(_routingContext.GetCurrentAgentId(), out var agentTypes))
423+
return true;
426424

427-
if (agentTypes == null || agentTypes.Count == 0)
425+
if (agentTypes.IsNullOrEmpty())
428426
return true;
429427

430428
var found = agentTypes.FirstOrDefault(t => t.Key == name);

0 commit comments

Comments
 (0)