diff --git a/window_manager/wm/src/window_adapter.cpp b/window_manager/wm/src/window_adapter.cpp index 23232c63e5da530b21495e772b9343eb96d921a5..7a4b11504b9753daa363ad69d6db7caa09bab2d7 100644 --- a/window_manager/wm/src/window_adapter.cpp +++ b/window_manager/wm/src/window_adapter.cpp @@ -187,14 +187,16 @@ bool WindowAdapter::InitWMSProxy() return false; } - wmsDeath_ = new WMSDeathRecipient(); - if (!wmsDeath_) { - WLOGFE("Failed to create death Recipient ptr WMSDeathRecipient"); - return false; - } - if (remoteObject->IsProxyObject() && !remoteObject->AddDeathRecipient(wmsDeath_)) { - WLOGFE("Failed to add death recipient"); - return false; + if (remoteObject->IsProxyObject()) { + wmsDeath_ = new WMSDeathRecipient(); + if (!wmsDeath_) { + WLOGFE("Failed to create death Recipient ptr WMSDeathRecipient"); + return false; + } + if (!remoteObject->AddDeathRecipient(wmsDeath_)) { + WLOGFE("Failed to add death recipient"); + return false; + } } isProxyValid_ = true; }