From 914ee2a56528ef6ec981c439b425c880becb19a5 Mon Sep 17 00:00:00 2001 From: l00635678 Date: Tue, 24 Sep 2024 10:18:52 +0800 Subject: [PATCH] =?UTF-8?q?NULL=E6=8C=87=E9=92=88=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E4=BF=9D=E6=8A=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: l00635678 --- services/src/cellular_data_handler.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/services/src/cellular_data_handler.cpp b/services/src/cellular_data_handler.cpp index 70212ddd..c53e686f 100644 --- a/services/src/cellular_data_handler.cpp +++ b/services/src/cellular_data_handler.cpp @@ -49,6 +49,7 @@ CellularDataHandler::CellularDataHandler(const EventFwk::CommonEventSubscribeInf void CellularDataHandler::Init() { + lastApnItem_ = new ApnItem(); apnManager_ = std::make_unique().release(); dataSwitchSettings_ = std::make_unique(slotId_); connectionManager_ = std::make_unique(slotId_).release(); @@ -69,7 +70,6 @@ void CellularDataHandler::Init() dataSwitchSettings_->LoadSwitchValue(); GetConfigurationFor5G(); SetRilLinkBandwidths(); - lastApnItem_ = new ApnItem(); } CellularDataHandler::~CellularDataHandler() @@ -291,6 +291,9 @@ void CellularDataHandler::ClearConnectionsOnUpdateApns(DisConnectionReason reaso auto apnItem = apnManager_->GetRilAttachApn(); if (!ApnHolder::IsCompatibleApnItem(lastApnItem_, apnItem, isRoaming)) { ClearAllConnections(reason); + if (lastApnItem_ == nullptr) { + lastApnItem_ = new ApnItem(); + } *lastApnItem_ = *apnItem; } } -- Gitee