Commit 8459cb06 authored by Marc Gravell's avatar Marc Gravell

fix #962 - avoid NRE, and ensure that CreateBridge(cmd) can spawn connections if needed

parent 5cb4cb51
......@@ -178,7 +178,7 @@ public PhysicalBridge GetBridge(RedisCommand command, bool create = true)
case RedisCommand.PUNSUBSCRIBE:
return subscription ?? (create ? subscription = CreateBridge(ConnectionType.Subscription, null) : null);
default:
return interactive;
return interactive ?? (create ? interactive = CreateBridge(ConnectionType.Interactive, null) : null);
}
}
......@@ -559,7 +559,7 @@ internal Task<T> WriteDirectAsync<T>(Message message, ResultProcessor<T> process
var source = ResultBox<T>.Get(tcs);
message.SetSource(processor, source);
if (bridge == null) bridge = GetBridge(message.Command);
var result = bridge.TryWrite(message, isSlave);
var result = bridge?.TryWrite(message, isSlave) ?? WriteResult.NoConnectionAvailable;
if (result != WriteResult.Success)
{
var ex = Multiplexer.GetException(result, message, this);
......
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