!324 【fix】hook层LOS_HOOK_TYPE_SEM_PEND的runningTask入参可能为空

Merge pull request !324 from Zhaotianyu/0926hook_fix
This commit is contained in:
openharmony_ci 2021-10-08 01:06:22 +00:00 committed by Gitee
commit 3eb4679f13
1 changed files with 2 additions and 1 deletions

View File

@ -232,6 +232,8 @@ LITE_OS_SEC_TEXT UINT32 LOS_SemPend(UINT32 semHandle, UINT32 timeout)
goto ERROR_SEM_PEND; goto ERROR_SEM_PEND;
} }
runningTask = (LosTaskCB *)g_losTask.runTask;
if (semPended->semCount > 0) { if (semPended->semCount > 0) {
semPended->semCount--; semPended->semCount--;
LOS_IntRestore(intSave); LOS_IntRestore(intSave);
@ -244,7 +246,6 @@ LITE_OS_SEC_TEXT UINT32 LOS_SemPend(UINT32 semHandle, UINT32 timeout)
goto ERROR_SEM_PEND; goto ERROR_SEM_PEND;
} }
runningTask = (LosTaskCB *)g_losTask.runTask;
runningTask->taskSem = (VOID *)semPended; runningTask->taskSem = (VOID *)semPended;
OsSchedTaskWait(&semPended->semList, timeout); OsSchedTaskWait(&semPended->semList, timeout);
LOS_IntRestore(intSave); LOS_IntRestore(intSave);