switched object comparison (directory selection)

prevents NPE when no directory was selected.