Fix segfault on pressing '1' when no document is open.