Update SessionBase.cs
- improving handling for Sessions loading with no default constructors available.
This commit is contained in:
parent
31c8231b2d
commit
48b76a84be
@ -130,7 +130,19 @@ namespace TelegramBotBase
|
||||
continue;
|
||||
}
|
||||
|
||||
var form = t.GetConstructor(new Type[] { }).Invoke(new object[] { }) as FormBase;
|
||||
var form = t.GetConstructor(new Type[] { })?.Invoke(new object[] { }) as FormBase;
|
||||
|
||||
//No default constructor
|
||||
if (form == null)
|
||||
{
|
||||
form = Activator.CreateInstance(t) as FormBase;
|
||||
|
||||
if (form == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (s.Values != null && s.Values.Count > 0)
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user