unbreak profiler_unittest when linking statically
When linking statically we may end up calling ProfilerGetCurrentState earlier than profiler is initialized. And we segfaulted on that early call. Lets make us handle this case gracefully.
This commit is contained in:
parent
f0bab33d27
commit
b128b1557e
|
@ -210,7 +210,7 @@ void ProfileData::GetCurrentState(State* state) const {
|
|||
state->start_time = start_time_;
|
||||
state->samples_gathered = count_;
|
||||
int buf_size = sizeof(state->profile_name);
|
||||
strncpy(state->profile_name, fname_, buf_size);
|
||||
strncpy(state->profile_name, fname_ ? fname_ : "", buf_size);
|
||||
state->profile_name[buf_size-1] = '\0';
|
||||
} else {
|
||||
state->enabled = false;
|
||||
|
|
Loading…
Reference in New Issue