!98 修复空指针异常

Merge pull request !98 from demon/master
This commit is contained in:
openharmony_ci
2022-03-16 07:18:30 +00:00
committed by Gitee
3 changed files with 12 additions and 6 deletions
@@ -43,6 +43,7 @@ namespace MiscServices {
if (inputControlChannel == nullptr) {
IMSA_HILOGI("InputMethodCoreProxy::initializeInput inputControlChannel is nullptr");
return ErrorCode::ERROR_NULL_POINTER;
}
IMSA_HILOGI("InputMethodCoreProxy::initializeInput displayId = %{public}d", displayId);
MessageParcel data, reply;
@@ -51,6 +52,7 @@ namespace MiscServices {
sptr<IRemoteObject> channelObject = inputControlChannel->AsObject();
if (channelObject == nullptr) {
IMSA_HILOGI("InputMethodCoreProxy::initializeInput channelObject is nullptr");
return ErrorCode::ERROR_NULL_POINTER;
}
bool wor = data.WriteRemoteObject(channelObject);
if (wor) {
@@ -137,6 +139,7 @@ namespace MiscServices {
}
if (inputDataChannel == nullptr) {
IMSA_HILOGI("InputMethodCoreProxy::startInput inputDataChannel is nullptr");
return false;
}
MessageParcel data;
+8 -6
View File
@@ -209,11 +209,11 @@ namespace MiscServices {
if (it == msgHandlers.end()) {
IMSA_HILOGE("InputMethodSystemAbility::StartInputService() need start handler");
MessageHandler *handler = new MessageHandler();
if (session == nullptr) {
IMSA_HILOGE("InputMethodSystemAbility::OnPrepareInput session is nullptr");
if (session != nullptr) {
IMSA_HILOGE("InputMethodSystemAbility::OnPrepareInput session is not nullptr");
session->CreateWorkThread(*handler);
msgHandlers.insert(std::pair<int32_t, MessageHandler*>(MAIN_USER_ID, handler));
}
session->CreateWorkThread(*handler);
msgHandlers.insert(std::pair<int32_t, MessageHandler*>(MAIN_USER_ID, handler));
}
bool isStartSuccess = false;
@@ -245,6 +245,7 @@ namespace MiscServices {
PerUserSession *session = GetUserSession(MAIN_USER_ID);
if (session == nullptr){
IMSA_HILOGE("InputMethodSystemAbility::StopInputService abort session is nullptr");
return;
}
session->StopInputService(imeId);
@@ -723,8 +724,6 @@ namespace MiscServices {
}
if (setting == nullptr || setting->GetUserState() != UserState::USER_STATE_UNLOCKED) {
IMSA_HILOGE("InputMethodSystemAbility::OnHandleMessage Aborted! userId = %{public}d,", userId);
IMSA_HILOGE("InputMethodSystemAbility::OnHandleMessage Aborted! userState = %{public}d",
setting->GetUserState());
return ErrorCode::ERROR_USER_NOT_UNLOCKED;
}
@@ -848,6 +847,9 @@ namespace MiscServices {
return ErrorCode::ERROR_USER_NOT_UNLOCKED;
}
PerUserSession *session = GetUserSession(userId);
if (session == nullptr) {
return ErrorCode::ERROR_NULL_POINTER;
}
int32_t ret = session->OnSettingChanged(updatedKey, updatedValue);
if (ret == ErrorCode::ERROR_SETTING_SAME_VALUE) {
IMSA_HILOGI("End...No need to update\n");
+1
View File
@@ -1182,6 +1182,7 @@ namespace MiscServices {
InputAttribute *attribute = data->ReadParcelable<InputAttribute>();
if (attribute == nullptr) {
IMSA_HILOGI("PerUserSession::OnPrepareInput attribute is nullptr");
return;
}
int ret = AddClient(pid, uid, displayId, client, channel, *attribute);