Skip to content

Commit ab4e59d

Browse files
committed
Make !configured checks in profiling.cpp soft checks, returning dummies.
1 parent 2ecefad commit ab4e59d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

core/profiling/profiling.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@
3939
namespace TracyInternal {
4040
static bool configured = false;
4141

42+
static const char dummy_string[] = "dummy";
43+
static tracy::SourceLocationData dummy_source_location = tracy::SourceLocationData{ dummy_string, dummy_string, dummy_string, 0, 0 };
44+
4245
// Implementation similar to StringName.
4346
struct StringInternData {
4447
StringName name;
@@ -109,12 +112,14 @@ const StringInternData *_intern_name(const StringName &p_name) {
109112
}
110113

111114
const char *intern_name(const StringName &p_name) {
115+
ERR_FAIL_COND_V(!configured, dummy_string);
116+
112117
MutexLock lock(TracyInternTable::mutex);
113118
return _intern_name(p_name)->name_utf8.get_data();
114119
}
115120

116121
const tracy::SourceLocationData *intern_source_location(const void *p_function_ptr, const StringName &p_file, const StringName &p_function, uint32_t p_line) {
117-
CRASH_COND(!configured);
122+
ERR_FAIL_COND_V(!configured, &dummy_source_location);
118123

119124
const uint32_t hash = HashMapHasherDefault::hash(p_function_ptr);
120125
const uint32_t idx = hash & TracyInternTable::TABLE_MASK;

0 commit comments

Comments
 (0)