Skip to content

Commit 3cb4d20

Browse files
committed
[NFC][sanitizer] Simplify GetThreadLocked
Now we can pass `invalid tid`.
1 parent df4c913 commit 3cb4d20

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compiler-rt/lib/sanitizer_common/sanitizer_thread_registry.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ class SANITIZER_MUTEX ThreadRegistry {
101101

102102
// Should be guarded by ThreadRegistryLock.
103103
ThreadContextBase *GetThreadLocked(u32 tid) {
104-
return threads_.empty() ? nullptr : threads_[tid];
104+
return tid < threads_.size() ? threads_[tid] : nullptr;
105105
}
106106

107107
u32 NumThreadsLocked() const { return threads_.size(); }

0 commit comments

Comments
 (0)