Fixed bug in directory detail view

If a directory does not exist, an exception occured before this fix.