From dfa479d409f305890c6687fa0a5389d08560cc37 Mon Sep 17 00:00:00 2001 From: FlorianDahn Date: Mon, 4 May 2020 15:18:48 +0200 Subject: [PATCH] Fix in StateMachines --- TelegramBotBase/States/JSONStateMachine.cs | 2 +- TelegramBotBase/States/SimpleJSONStateMachine.cs | 2 +- TelegramBotBase/States/XMLStateMachine.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/TelegramBotBase/States/JSONStateMachine.cs b/TelegramBotBase/States/JSONStateMachine.cs index d8995be..7035692 100644 --- a/TelegramBotBase/States/JSONStateMachine.cs +++ b/TelegramBotBase/States/JSONStateMachine.cs @@ -36,7 +36,7 @@ namespace TelegramBotBase.States this.FallbackStateForm = fallbackStateForm; - if (!this.FallbackStateForm.IsSubclassOf(typeof(FormBase))) + if (this.FallbackStateForm != null && !this.FallbackStateForm.IsSubclassOf(typeof(FormBase))) { throw new ArgumentException("FallbackStateForm is not a subclass of FormBase"); } diff --git a/TelegramBotBase/States/SimpleJSONStateMachine.cs b/TelegramBotBase/States/SimpleJSONStateMachine.cs index 0b6e9e5..faba2af 100644 --- a/TelegramBotBase/States/SimpleJSONStateMachine.cs +++ b/TelegramBotBase/States/SimpleJSONStateMachine.cs @@ -36,7 +36,7 @@ namespace TelegramBotBase.States this.FallbackStateForm = fallbackStateForm; - if (!this.FallbackStateForm.IsSubclassOf(typeof(FormBase))) + if (this.FallbackStateForm != null && !this.FallbackStateForm.IsSubclassOf(typeof(FormBase))) { throw new ArgumentException("FallbackStateForm is not a subclass of FormBase"); } diff --git a/TelegramBotBase/States/XMLStateMachine.cs b/TelegramBotBase/States/XMLStateMachine.cs index 76fe5bd..2542f6a 100644 --- a/TelegramBotBase/States/XMLStateMachine.cs +++ b/TelegramBotBase/States/XMLStateMachine.cs @@ -35,7 +35,7 @@ namespace TelegramBotBase.States this.FallbackStateForm = fallbackStateForm; - if (!this.FallbackStateForm.IsSubclassOf(typeof(FormBase))) + if (this.FallbackStateForm != null && !this.FallbackStateForm.IsSubclassOf(typeof(FormBase))) { throw new ArgumentException("FallbackStateForm is not a subclass of FormBase"); }