From 6d056227056db1a64d1421d60a967459fd9f3ac1 Mon Sep 17 00:00:00 2001 From: alex-ubitec <56241161+alex-ubitec@users.noreply.github.com> Date: Wed, 1 Jul 2020 12:08:39 +0700 Subject: [PATCH] Result is not necessarily defined here You can get an undefined result at this point, since `runStep` can be called with an empty result. I don't believe it is assumed that an action handler is called always after the previous step generated a result Until this is fixed, what would be an alternative? --- packages/botkit/src/conversation.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/botkit/src/conversation.ts b/packages/botkit/src/conversation.ts index 0f0cc8ab4..bc518d8c6 100644 --- a/packages/botkit/src/conversation.ts +++ b/packages/botkit/src/conversation.ts @@ -962,7 +962,7 @@ export class BotkitConversation extends Dialog { const index = step.index; const thread_name = step.thread; const result = step.result; - const response = result.text || (typeof (result) === 'string' ? result : null); + const response = result == null ? null : (result.text || (typeof (result) === 'string' ? result : null)); // spawn a bot instance so devs can use API or other stuff as necessary const bot = await this._controller.spawn(dc);