Index: kernel/generic/src/time/clock.c
===================================================================
--- kernel/generic/src/time/clock.c	(revision 3ff2b5474db5d13ba2132c533593a7bcdbf4126a)
+++ kernel/generic/src/time/clock.c	(revision 8af9950eef9c2c7dfd3ef398eb581435b1f15ac1)
@@ -190,11 +190,15 @@
 		
 		if (!ticks && !PREEMPTION_DISABLED) {
+#ifdef CONFIG_UDEBUG
+			istate_t *istate;
+#endif
 			scheduler();
 #ifdef CONFIG_UDEBUG
 			/*
 			 * Give udebug chance to stop the thread
-			 * before it begins executing.
+			 * before it begins executing userspace code.
 			 */
-			if (istate_from_uspace(THREAD->udebug.uspace_state))
+			istate = THREAD->udebug.uspace_state;
+			if (istate && istate_from_uspace(istate))
 				udebug_before_thread_runs();
 #endif
