fix "list index out of range"

I got a "list index out of range" error if no folders is opened.