Fixed bug that redis nsq adapter cannot work when topics is null. (#5303)

This commit is contained in:
李铭昕 2023-01-08 20:49:18 +08:00 committed by GitHub
parent a601a5e3ec
commit ab513b4a1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -85,7 +85,7 @@ class RedisNsqAdapter extends RedisAdapter
$response = $client->stats('json', $this->getChannelKey());
if ($response->getStatusCode() == 200) {
$json = Json::decode((string) $response->getBody());
foreach ($json['topics'] as $topic) {
foreach ($json['topics'] ?? [] as $topic) {
if (Arr::get($topic, 'topic_name') !== $this->getChannelKey()) {
continue;
}