Fix the exception which occurs when a click happens when the diagram panel is empty after the creation of the project.