From ada725a50a60867af3422c8e612aecaeea856a9a Mon Sep 17 00:00:00 2001
From: Mark Thomas <markt@apache.org>
Date: Fri, 3 May 2019 21:52:41 +0100
Subject: [PATCH] Fix test failures. Handle full allocation case.

https://github.com/apache/tomcat/commit/ada725a
---
 java/org/apache/coyote/http2/Http2UpgradeHandler.java | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/coyote/http2/Http2UpgradeHandler.java b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
index ab0369a..cadae44 100644
--- a/java/org/apache/coyote/http2/Http2UpgradeHandler.java
+++ b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
@@ -804,8 +804,10 @@ class Http2UpgradeHandler extends AbstractStream implements InternalHttpUpgradeH
                             stream.wait(writeTimeout);
                         }
                         // Has this stream been granted an allocation
+                        // Note: If the stream in not in this Map then the
+                        //       requested write has been fully allocated
                         int[] value = backLogStreams.get(stream);
-                        if (value[1] == 0) {
+                        if (value != null && value[1] == 0) {
                             // No allocation
                             // Close the connection. Do this first since
                             // closing the stream will raise an exception
--
2.19.1
