From 583ca4301c1300464730918f4c683fffe6d71e26 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Thu, 29 Nov 2018 16:05:02 +0900 Subject: [PATCH] Add an exception handling on C Generator Change-Id: I23b5f47df62cc5180f3bd12c7c729d5d840eba20 Signed-off-by: Hwankyu Jhun --- idlc/c_gen/c_proxy_body_gen_cb.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/idlc/c_gen/c_proxy_body_gen_cb.h b/idlc/c_gen/c_proxy_body_gen_cb.h index 95a8714..277ad2c 100644 --- a/idlc/c_gen/c_proxy_body_gen_cb.h +++ b/idlc/c_gen/c_proxy_body_gen_cb.h @@ -266,10 +266,15 @@ R"__c_cb( static void __##_on_received(const char *endpoint, const char *port_name, void *data) { rpc_port_proxy_##_h handle = data; - rpc_port_parcel_h parcel_received; + rpc_port_parcel_h parcel_received = NULL; int cmd = -1; rpc_port_parcel_create_from_port(&parcel_received, handle->callback_port); + if (!parcel_received) { + _E("Failed to create parcel from port(%s)", port_name); + return; + } + rpc_port_parcel_read_int32(parcel_received, &cmd); if (cmd != ##_METHOD_Callback) { _E("Invalid protocol"); -- 2.7.4