@@ -320,7 +320,14 @@ func (ec *Client) SyncProgress(ctx context.Context) (*ethereum.SyncProgress, err
320320// SubscribeNewHead subscribes to notifications about the current blockchain head 
321321// on the given channel. 
322322func  (ec  * Client ) SubscribeNewHead (ctx  context.Context , ch  chan <-  * types.Header ) (ethereum.Subscription , error ) {
323- 	return  ec .c .EthSubscribe (ctx , ch , "newHeads" )
323+ 	sub , err  :=  ec .c .EthSubscribe (ctx , ch , "newHeads" )
324+ 	if  err  !=  nil  {
325+ 		// Defensively prefer returning nil interface explicitly on error-path, instead 
326+ 		// of letting default golang behavior wrap it with non-nil interface that stores 
327+ 		// nil concrete type value. 
328+ 		return  nil , err 
329+ 	}
330+ 	return  sub , nil 
324331}
325332
326333// State Access 
@@ -389,7 +396,14 @@ func (ec *Client) SubscribeFilterLogs(ctx context.Context, q ethereum.FilterQuer
389396	if  err  !=  nil  {
390397		return  nil , err 
391398	}
392- 	return  ec .c .EthSubscribe (ctx , ch , "logs" , arg )
399+ 	sub , err  :=  ec .c .EthSubscribe (ctx , ch , "logs" , arg )
400+ 	if  err  !=  nil  {
401+ 		// Defensively prefer returning nil interface explicitly on error-path, instead 
402+ 		// of letting default golang behavior wrap it with non-nil interface that stores 
403+ 		// nil concrete type value. 
404+ 		return  nil , err 
405+ 	}
406+ 	return  sub , nil 
393407}
394408
395409func  toFilterArg (q  ethereum.FilterQuery ) (interface {}, error ) {
0 commit comments