Fix segfault if document could not be opened
Check for empty paths