added some cases to prevent crashing

fixed crashing on excess whitespace and if the maze file is empty.