diff --git a/src/g_demo.c b/src/g_demo.c
index 0efba5a59724f3b64f3a9ed9dbcf1d137a472e47..158e05adf0d7bc57d24e1cd451bcaf42391a7f49 100644
--- a/src/g_demo.c
+++ b/src/g_demo.c
@@ -549,6 +549,9 @@ void G_ConsGhostTic(void)
 
 	testmo = players[0].mo;
 
+	if (!testmo)
+		return; // No valid mobj exists, probably because of unexpected quit
+
 	// Grab ghost data.
 	ziptic = READUINT8(demo_p);
 	if (ziptic & GZT_XYZ)