Commit 2b789576 authored by Marc Gravell's avatar Marc Gravell

fix NRE on ExecuteMessage

parent dc845537
...@@ -3227,13 +3227,13 @@ internal sealed class ExecuteMessage : Message ...@@ -3227,13 +3227,13 @@ internal sealed class ExecuteMessage : Message
public new CommandBytes Command => _command; public new CommandBytes Command => _command;
public ExecuteMessage(CommandMap map, int db, CommandFlags flags, string command, ICollection<object> args) : base(db, flags, RedisCommand.UNKNOWN) public ExecuteMessage(CommandMap map, int db, CommandFlags flags, string command, ICollection<object> args) : base(db, flags, RedisCommand.UNKNOWN)
{ {
_args = args ?? Array.Empty<object>(); if (args != null && args.Count >= PhysicalConnection.REDIS_MAX_ARGS) // using >= here because we will be adding 1 for the command itself (which is an arg for the purposes of the multi-bulk protocol)
if (args.Count >= PhysicalConnection.REDIS_MAX_ARGS) // using >= here because we will be adding 1 for the command itself (which is an arg for the purposes of the multi-bulk protocol)
{ {
throw ExceptionFactory.TooManyArgs(command, args.Count); throw ExceptionFactory.TooManyArgs(command, args.Count);
} }
_command = map?.GetBytes(command) ?? default; _command = map?.GetBytes(command) ?? default;
if (_command.IsEmpty) throw ExceptionFactory.CommandDisabled(command); if (_command.IsEmpty) throw ExceptionFactory.CommandDisabled(command);
_args = args ?? Array.Empty<object>();
} }
protected override void WriteImpl(PhysicalConnection physical) protected override void WriteImpl(PhysicalConnection physical)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment