diff --git a/frameworks/ans/src/notification_icon_button.cpp b/frameworks/ans/src/notification_icon_button.cpp index 0c799fc439bc74dd99c7d5d76541d0941d047007..96d43b5800130a78da442dd872098daa4f8bc8f4 100644 --- a/frameworks/ans/src/notification_icon_button.cpp +++ b/frameworks/ans/src/notification_icon_button.cpp @@ -145,6 +145,7 @@ NotificationIconButton *NotificationIconButton::FromJson(const nlohmann::json &j if (pIcon == nullptr) { ANS_LOGE("Failed to parse button icon"); delete button; + button = nullptr; } else { button->SetIconImage(pIcon); } @@ -154,6 +155,7 @@ NotificationIconButton *NotificationIconButton::FromJson(const nlohmann::json &j if (pIcon == nullptr) { ANS_LOGE("Failed to parse button icon"); delete button; + button = nullptr; } else { button->SetIconImage(pIcon); }