Fix crash on empty editor.

closes #1