fix NRE introduced in 3.17.3 (#3101)
This commit is contained in:
@@ -20,9 +20,13 @@ namespace Discord
|
||||
{
|
||||
get => _name;
|
||||
set
|
||||
{
|
||||
if (value is not null)
|
||||
{
|
||||
Preconditions.AtLeast(value.Length, 1, nameof(Name));
|
||||
Preconditions.AtMost(value.Length, 100, nameof(Name));
|
||||
}
|
||||
|
||||
_name = value;
|
||||
}
|
||||
}
|
||||
@@ -38,7 +42,7 @@ namespace Discord
|
||||
get => _value;
|
||||
set
|
||||
{
|
||||
if (value != null && value is not string && !value.IsNumericType())
|
||||
if (value is not null && value is not string && !value.IsNumericType())
|
||||
throw new ArgumentException($"The value of a choice must be a string or a numeric type! Value: \"{value}\"");
|
||||
_value = value;
|
||||
}
|
||||
|
||||
@@ -23,9 +23,13 @@ public class ButtonBuilder
|
||||
{
|
||||
get => _label;
|
||||
set
|
||||
{
|
||||
if (value is not null)
|
||||
{
|
||||
Preconditions.AtLeast(value.Length, 1, nameof(Label));
|
||||
Preconditions.AtMost(value.Length, MaxButtonLabelLength, nameof(Label));
|
||||
}
|
||||
|
||||
_label = value;
|
||||
}
|
||||
}
|
||||
@@ -39,9 +43,13 @@ public class ButtonBuilder
|
||||
{
|
||||
get => _customId;
|
||||
set
|
||||
{
|
||||
if (value is not null)
|
||||
{
|
||||
Preconditions.AtLeast(value.Length, 1, nameof(CustomId));
|
||||
Preconditions.AtMost(value.Length, ComponentBuilder.MaxCustomIdLength, nameof(CustomId));
|
||||
}
|
||||
|
||||
_customId = value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,9 +34,13 @@ public class SelectMenuBuilder
|
||||
{
|
||||
get => _customId;
|
||||
set
|
||||
{
|
||||
if (value is not null)
|
||||
{
|
||||
Preconditions.AtLeast(value.Length, 1, nameof(CustomId));
|
||||
Preconditions.AtMost(value.Length, ComponentBuilder.MaxCustomIdLength, nameof(CustomId));
|
||||
}
|
||||
|
||||
_customId = value;
|
||||
}
|
||||
}
|
||||
@@ -62,9 +66,13 @@ public class SelectMenuBuilder
|
||||
{
|
||||
get => _placeholder;
|
||||
set
|
||||
{
|
||||
if (value is not null)
|
||||
{
|
||||
Preconditions.AtLeast(value.Length, 1, nameof(Placeholder));
|
||||
Preconditions.AtMost(value.Length, MaxPlaceholderLength, nameof(Placeholder));
|
||||
}
|
||||
|
||||
_placeholder = value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,9 +31,13 @@ public class SelectMenuOptionBuilder
|
||||
{
|
||||
get => _label;
|
||||
set
|
||||
{
|
||||
if (value is not null)
|
||||
{
|
||||
Preconditions.AtLeast(value.Length, 1, nameof(Label));
|
||||
Preconditions.AtMost(value.Length, MaxSelectLabelLength, nameof(Label));
|
||||
}
|
||||
|
||||
_label = value;
|
||||
}
|
||||
}
|
||||
@@ -47,9 +51,13 @@ public class SelectMenuOptionBuilder
|
||||
{
|
||||
get => _value;
|
||||
set
|
||||
{
|
||||
if (value is not null)
|
||||
{
|
||||
Preconditions.AtLeast(value.Length, 1, nameof(Value));
|
||||
Preconditions.AtMost(value.Length, MaxSelectValueLength, nameof(Value));
|
||||
}
|
||||
|
||||
_value = value;
|
||||
}
|
||||
}
|
||||
@@ -63,9 +71,13 @@ public class SelectMenuOptionBuilder
|
||||
{
|
||||
get => _description;
|
||||
set
|
||||
{
|
||||
if (value is not null)
|
||||
{
|
||||
Preconditions.AtLeast(value.Length, 1, nameof(Description));
|
||||
Preconditions.AtMost(value.Length, MaxDescriptionLength, nameof(Description));
|
||||
}
|
||||
|
||||
_description = value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,9 +23,13 @@ public class TextInputBuilder
|
||||
{
|
||||
get => _customId;
|
||||
set
|
||||
{
|
||||
if (value is not null)
|
||||
{
|
||||
Preconditions.AtLeast(value.Length, 1, nameof(CustomId));
|
||||
Preconditions.AtMost(value.Length, ComponentBuilder.MaxCustomIdLength, nameof(CustomId));
|
||||
}
|
||||
|
||||
_customId = value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,9 +39,13 @@ namespace Discord
|
||||
{
|
||||
get => _customId;
|
||||
set
|
||||
{
|
||||
if (value is not null)
|
||||
{
|
||||
Preconditions.AtLeast(value.Length, 1, nameof(CustomId));
|
||||
Preconditions.AtMost(value.Length, ComponentBuilder.MaxCustomIdLength, nameof(CustomId));
|
||||
}
|
||||
|
||||
_customId = value;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user