Fixed GetService exception when required is true
This commit is contained in:
@@ -287,8 +287,6 @@ namespace Discord
|
|||||||
T serviceT = null;
|
T serviceT = null;
|
||||||
if (_services.TryGetValue(typeof(T), out service))
|
if (_services.TryGetValue(typeof(T), out service))
|
||||||
serviceT = service as T;
|
serviceT = service as T;
|
||||||
else
|
|
||||||
return null;
|
|
||||||
|
|
||||||
if (serviceT == null && required)
|
if (serviceT == null && required)
|
||||||
throw new InvalidOperationException($"This operation requires {nameof(T)} to be added to {nameof(DiscordClient)}.");
|
throw new InvalidOperationException($"This operation requires {nameof(T)} to be added to {nameof(DiscordClient)}.");
|
||||||
|
|||||||
Reference in New Issue
Block a user