Exception when showing studio page

Add protection if mode is illegal and NPE check