Browse Source

workaround crash when V is not in context

Shelikhoo 4 years ago
parent
commit
e8ac0412a5
1 changed files with 3 additions and 0 deletions
  1. 3 0
      transport/internet/tagged/taggedimpl/impl.go

+ 3 - 0
transport/internet/tagged/taggedimpl/impl.go

@@ -13,6 +13,9 @@ import (
 
 
 func DialTaggedOutbound(ctx context.Context, dest net.Destination, tag string) (net.Conn, error) {
 func DialTaggedOutbound(ctx context.Context, dest net.Destination, tag string) (net.Conn, error) {
 	var dispatcher routing.Dispatcher
 	var dispatcher routing.Dispatcher
+	if core.FromContext(ctx) == nil {
+		return nil, newError("Instance context variable is not in context, dial denied. ")
+	}
 	if err := core.RequireFeatures(ctx, func(dispatcherInstance routing.Dispatcher) {
 	if err := core.RequireFeatures(ctx, func(dispatcherInstance routing.Dispatcher) {
 		dispatcher = dispatcherInstance
 		dispatcher = dispatcherInstance
 	}); err != nil {
 	}); err != nil {