Avoid NPE for handling client settings null in notifyClientTermination. (#9308)

This commit is contained in:
Jixiang Jin
2025-04-02 18:54:07 +08:00
committed by GitHub
parent 586a274839
commit 445b94514a
@@ -138,6 +138,12 @@ public class ClientActivity extends AbstractMessingActivity {
String clientId = ctx.getClientID();
LanguageCode languageCode = LanguageCode.valueOf(ctx.getLanguage());
Settings clientSettings = grpcClientSettingsManager.removeAndGetClientSettings(ctx);
if (clientSettings == null) {
future.complete(NotifyClientTerminationResponse.newBuilder()
.setStatus(ResponseBuilder.getInstance().buildStatus(Code.UNRECOGNIZED_CLIENT_TYPE, "cannot find client settings for this client"))
.build());
return future;
}
switch (clientSettings.getClientType()) {
case PRODUCER: