diff --git a/frameworks/native/running_lock.cpp b/frameworks/native/running_lock.cpp index 56ea986f0515fa6b12c64ddba1fb59b02efa64af..52aebb4cb669096198156cb43c4faa7551fda459 100644 --- a/frameworks/native/running_lock.cpp +++ b/frameworks/native/running_lock.cpp @@ -93,6 +93,10 @@ ErrCode RunningLock::Lock(int32_t timeOutMs) POWER_HILOGE(FEATURE_RUNNING_LOCK, "LProxy=null"); return E_GET_POWER_SERVICE_FAILED; } + if (token_ == nullptr) { + POWER_HILOGE(FEATURE_RUNNING_LOCK, "token_=nullptr"); + return PowerErrors::ERR_CONNECTION_FAIL; + } POWER_HILOGD(FEATURE_RUNNING_LOCK, "Service side Lock call, timeOutMs=%{public}d", timeOutMs); if (runningLockInfo_.type == RunningLockType::RUNNINGLOCK_PROXIMITY_SCREEN_CONTROL) { timeOutMs = NOT_USE_TIMEOUT;