From 4151d1d60087558e8adac8f01df97b25f7c4b22f Mon Sep 17 00:00:00 2001 From: practicalswift Date: Tue, 3 Nov 2015 14:34:31 +0100 Subject: [PATCH] Fix segfault-on-emu_stop() bug. --- uc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/uc.c b/uc.c index 00efc805..e3107b70 100644 --- a/uc.c +++ b/uc.c @@ -525,8 +525,10 @@ uc_err uc_emu_stop(uc_engine *uc) return UC_ERR_OK; uc->stop_request = true; - // exit the current TB - cpu_exit(uc->current_cpu); + if (uc->current_cpu) { + // exit the current TB + cpu_exit(uc->current_cpu); + } return UC_ERR_OK; }