Exception: Call to a member function getPath() on bool