prevent NPE on .trim()
fix drawing problems: selected text could sometimes disappear (e.g. when selecting text after start up, but before the first errors were marked)