aboutsummaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/k_thread.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2021-05-29 01:17:28 -0700
committerGitHub <noreply@github.com>2021-05-29 01:17:28 -0700
commit6864ccfee8e8cb2377ea3f968279863ec9330ba8 (patch)
tree16742f5331403173ab7bd6d3d32dc5cf56ce0267 /src/core/hle/kernel/k_thread.cpp
parentfb86819b395486c8c53bb2c8432b3b6b6f5e0e3b (diff)
parent2d390c1911b89a7370ef99af092523386b4fd08e (diff)
Merge pull request #6382 from lioncash/null
k_thread: Move dereference after null check in Initialize()
Diffstat (limited to 'src/core/hle/kernel/k_thread.cpp')
-rw-r--r--src/core/hle/kernel/k_thread.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/core/hle/kernel/k_thread.cpp b/src/core/hle/kernel/k_thread.cpp
index e3f08f2565..3cf43d290e 100644
--- a/src/core/hle/kernel/k_thread.cpp
+++ b/src/core/hle/kernel/k_thread.cpp
@@ -168,13 +168,13 @@ ResultCode KThread::Initialize(KThreadFunction func, uintptr_t arg, VAddr user_s
std::memset(static_cast<void*>(std::addressof(GetStackParameters())), 0,
sizeof(StackParameters));
- // Setup the TLS, if needed.
- if (type == ThreadType::User) {
- tls_address = owner->CreateTLSRegion();
- }
-
// Set parent, if relevant.
if (owner != nullptr) {
+ // Setup the TLS, if needed.
+ if (type == ThreadType::User) {
+ tls_address = owner->CreateTLSRegion();
+ }
+
parent = owner;
parent->Open();
parent->IncrementThreadCount();