From 385142bb9ec9bdfcb8d46f38f0a6f054d6448dbf Mon Sep 17 00:00:00 2001
From: Paul Gofman <pgofman@codeweavers.com>
Date: Mon, 24 May 2021 14:45:40 +0300
Subject: [PATCH] server: Check for system regs before suspending for ptrace.

Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
---
 server/ptrace.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/server/ptrace.c b/server/ptrace.c
index 3621e8d82ad..b2d23d89aaf 100644
--- a/server/ptrace.c
+++ b/server/ptrace.c
@@ -571,15 +571,15 @@ void get_thread_context( struct thread *thread, context_t *context, unsigned int
     /* all other regs are handled on the client side */
     assert( flags == SERVER_CTX_DEBUG_REGISTERS );
 
-    if (!suspend_for_ptrace( thread )) return;
-
     if (!(thread->system_regs & SERVER_CTX_DEBUG_REGISTERS))
     {
         /* caller has initialized everything to 0 already, just return */
         context->flags |= SERVER_CTX_DEBUG_REGISTERS;
-        goto done;
+        return;
     }
 
+    if (!suspend_for_ptrace( thread )) return;
+
     for (i = 0; i < 8; i++)
     {
         if (i == 4 || i == 5) continue;