Browse Source

Fix potential nullref in embedBuilder value setter

pull/734/head
moiph 8 years ago
parent
commit
73d158d56a
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      src/Discord.Net.Rest/Entities/Messages/EmbedBuilder.cs

+ 1
- 1
src/Discord.Net.Rest/Entities/Messages/EmbedBuilder.cs View File

@@ -260,7 +260,7 @@ namespace Discord
get => _field.Value; get => _field.Value;
set set
{ {
var stringValue = value.ToString();
var stringValue = value?.ToString();
if (string.IsNullOrEmpty(stringValue)) throw new ArgumentException($"Field value must not be null or empty.", nameof(Value)); if (string.IsNullOrEmpty(stringValue)) throw new ArgumentException($"Field value must not be null or empty.", nameof(Value));
if (stringValue.Length > MaxFieldValueLength) throw new ArgumentException($"Field value length must be less than or equal to {MaxFieldValueLength}.", nameof(Value)); if (stringValue.Length > MaxFieldValueLength) throw new ArgumentException($"Field value length must be less than or equal to {MaxFieldValueLength}.", nameof(Value));
_field.Value = stringValue; _field.Value = stringValue;


Loading…
Cancel
Save