fix pybullet.submitProfileTiming

This commit is contained in:
Erwin Coumans
2019-12-19 18:05:41 -08:00
parent 9c7e6d6a48
commit 7a4023430a

View File

@@ -5481,18 +5481,16 @@ B3_SHARED_API b3SharedMemoryCommandHandle b3ProfileTimingCommandInit(b3PhysicsCl
b3Assert(command); b3Assert(command);
int len = name ? strlen(name) : 0; int len = name ? strlen(name) : 0;
command->m_type = CMD_PROFILE_TIMING;
if (len > 0 && len < (MAX_FILENAME_LENGTH + 1)) if (len > 0 && len < (MAX_FILENAME_LENGTH + 1))
{ {
command->m_type = CMD_PROFILE_TIMING;
strcpy(command->m_profile.m_name, name); strcpy(command->m_profile.m_name, name);
command->m_profile.m_name[len] = 0; command->m_profile.m_name[len] = 0;
} }
else else
{ {
const char* invalid = "InvalidProfileTimingName"; command->m_profile.m_name[0] = 0;
int len = strlen(invalid);
strcpy(command->m_profile.m_name, invalid);
command->m_profile.m_name[len] = 0;
} }
command->m_profile.m_type = -1; command->m_profile.m_type = -1;
command->m_profile.m_durationInMicroSeconds = 0; command->m_profile.m_durationInMicroSeconds = 0;