Skip to content

Commit 445b945

Browse files
authored
Avoid NPE for handling client settings null in notifyClientTermination. (#9308)
1 parent 586a274 commit 445b945

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/client/ClientActivity.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,12 @@ public CompletableFuture<NotifyClientTerminationResponse> notifyClientTerminatio
138138
String clientId = ctx.getClientID();
139139
LanguageCode languageCode = LanguageCode.valueOf(ctx.getLanguage());
140140
Settings clientSettings = grpcClientSettingsManager.removeAndGetClientSettings(ctx);
141+
if (clientSettings == null) {
142+
future.complete(NotifyClientTerminationResponse.newBuilder()
143+
.setStatus(ResponseBuilder.getInstance().buildStatus(Code.UNRECOGNIZED_CLIENT_TYPE, "cannot find client settings for this client"))
144+
.build());
145+
return future;
146+
}
141147

142148
switch (clientSettings.getClientType()) {
143149
case PRODUCER:

0 commit comments

Comments
 (0)