diff --git a/src/target/target.c b/src/target/target.c
index 80e2c4cf21d06b0ce0d1b84929d162f32f46ceb0..b8e4c2ff9ed937dc0720b2f98634a3c6923aa074 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -5131,8 +5131,10 @@ static int jim_target_smp(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
 		target->head = head;
 		curr = curr->next;
 	}
-	if (target->rtos)
+
+	if (target && target->rtos)
 		retval = rtos_smp_init(head->target);
+
 	return retval;
 }