From e78801300a235bb0b9fc3d32f4a043ac5bcc2c6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E4=BA=AE?= Date: Thu, 2 Mar 2023 16:35:18 +0800 Subject: [PATCH] fixed f06ead0 from https://gitee.com/yangliang36/notification_distributed_notification_service/pulls/943 fix crash caused by nullptr MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 杨亮 --- services/ans/src/notification_preferences_database.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/services/ans/src/notification_preferences_database.cpp b/services/ans/src/notification_preferences_database.cpp index 73ecb3838..ce85d2d25 100644 --- a/services/ans/src/notification_preferences_database.cpp +++ b/services/ans/src/notification_preferences_database.cpp @@ -293,10 +293,13 @@ NotificationPreferencesDatabase::~NotificationPreferencesDatabase() bool NotificationPreferencesDatabase::CheckRdbStore() { - int32_t result = rdbDataManager_->Init(); - if (result == NativeRdb::E_OK) { - return true; + if (rdbDataManager_ != nullptr) { + int32_t result = rdbDataManager_->Init(); + if (result == NativeRdb::E_OK) { + return true; + } } + return false; } -- Gitee