Fixed a bug with unselected document

When no document is open, and you run, it gives an exception
Only get currentDoc when we use cwd
Merge branch 'notSelectedExceptionFix'