From 17c0d37ae539d6e4b0033bebf3838bbf3e25a8f2 Mon Sep 17 00:00:00 2001 From: Ankur Jain Date: Thu, 28 Jan 2021 04:10:58 -0800 Subject: [PATCH] Proper NPE fix (#436) Co-authored-by: Vyacheslav Egorov --- lib/src/client/http2_connection.dart | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/src/client/http2_connection.dart b/lib/src/client/http2_connection.dart index d0a50b4b..ce87d6ab 100644 --- a/lib/src/client/http2_connection.dart +++ b/lib/src/client/http2_connection.dart @@ -161,8 +161,9 @@ class Http2ClientConnection implements connection.ClientConnection { metadata, compressionCodec, userAgent: options.userAgent, - grpcAcceptEncodings: callOptions?.metadata['grpc-accept-encoding'] ?? - options.codecRegistry?.supportedEncodings, + grpcAcceptEncodings: + (callOptions?.metadata ?? const {})['grpc-accept-encoding'] ?? + options.codecRegistry?.supportedEncodings, ); final stream = _transportConnection.makeRequest(headers); return Http2TransportStream(