fix crash with out of range thread index
This commit is contained in:
@@ -184,7 +184,7 @@ void MyEnterProfileZoneFunc(const char* msg)
|
|||||||
return;
|
return;
|
||||||
#ifndef BT_NO_PROFILE
|
#ifndef BT_NO_PROFILE
|
||||||
int threadId = btQuickprofGetCurrentThreadIndex2();
|
int threadId = btQuickprofGetCurrentThreadIndex2();
|
||||||
if (threadId<0)
|
if (threadId<0 || threadId >= BT_QUICKPROF_MAX_THREAD_COUNT)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (gStackDepths[threadId] >= MAX_NESTING)
|
if (gStackDepths[threadId] >= MAX_NESTING)
|
||||||
@@ -208,8 +208,8 @@ void MyLeaveProfileZoneFunc()
|
|||||||
return;
|
return;
|
||||||
#ifndef BT_NO_PROFILE
|
#ifndef BT_NO_PROFILE
|
||||||
int threadId = btQuickprofGetCurrentThreadIndex2();
|
int threadId = btQuickprofGetCurrentThreadIndex2();
|
||||||
if (threadId<0)
|
if (threadId<0 || threadId >= BT_QUICKPROF_MAX_THREAD_COUNT)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (gStackDepths[threadId] <= 0)
|
if (gStackDepths[threadId] <= 0)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user