aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdbstub.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gdbstub.c b/gdbstub.c
index 23baaef..141d7bc 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -94,7 +94,7 @@ static inline int cpu_gdb_index(CPUState *cpu)
{
#if defined(CONFIG_USER_ONLY)
TaskState *ts = (TaskState *) cpu->opaque;
- return ts->ts_tid;
+ return ts ? ts->ts_tid : -1;
#else
return cpu->cpu_index + 1;
#endif