Dont run onsidetoggled if tree view is off. Fixes #272

Causes a crash because you can't detach stuff that doesn't exist. Fixes #272