Skip to content

Commit 34eb2c6

Browse files
committed
Fix null ggipc_subscribe_to_topic handlers
1 parent 6679c06 commit 34eb2c6

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/ipc/client/subscribe_to_topic.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,27 @@ static GglError subscribe_to_topic_resp_handler(
8989
GglBuffer topic = ggl_obj_into_buf(*topic_obj);
9090

9191
if (is_json) {
92+
if (callbacks->json_handler == NULL) {
93+
GGL_LOGW(
94+
"Skipping unhandled JSON payload on local topic %.*s.",
95+
(int) topic.len,
96+
topic.data
97+
);
98+
return GGL_ERR_OK;
99+
}
100+
92101
GglMap payload = ggl_obj_into_map(*message_obj);
93102
callbacks->json_handler(topic, payload, handle);
94103
} else {
104+
if (callbacks->json_handler == NULL) {
105+
GGL_LOGW(
106+
"Skipping unhandled binary payload on local topic %.*s.",
107+
(int) topic.len,
108+
topic.data
109+
);
110+
return GGL_ERR_OK;
111+
}
112+
95113
GglBuffer payload = ggl_obj_into_buf(*message_obj);
96114
if (!ggl_base64_decode_in_place(&payload)) {
97115
GGL_LOGE("Failed to decode pubsub subscription response payload.");

0 commit comments

Comments
 (0)