已合并
Add check null for g_dataChannel #57
wuzhihuitmac创建于 2月25日
Add check null for g_dataChannel #57
已合并
wuzhihuitmac创建于 2月25日
已删除 :OpenHarmony-5.0.3-Release合入到openharmony/sensors_medical_sensorOpenHarmony-6.0-Release
1 个文件变更+4-0
Minterfaces/native/src/medical_native_impl.cpp+4-0
@@ -69,6 +69,10 @@ static int32_t CreateSensorDataChannel()
69 }69 }
70 if (g_dataChannel == nullptr) {70 if (g_dataChannel == nullptr) {
71 g_dataChannel = new (std::nothrow) MedicalSensorDataChannel();71 g_dataChannel = new (std::nothrow) MedicalSensorDataChannel();
72+ if (g_dataChannel == nullptr) {
73+ HiLog::Error(LABEL, "%{public}s g_dataChannel is null", __func__);
74+ return OHOS::Sensors::ERROR;
75+ }
72 }76 }
73 auto ret = g_dataChannel->CreateSensorDataChannel(HandleSensorData, nullptr);77 auto ret = g_dataChannel->CreateSensorDataChannel(HandleSensorData, nullptr);
74 if (ret != SUCCESS) {78 if (ret != SUCCESS) {