Update index.php

Added a check to prevent crashing if invalid view type is selected