I have a VF page which is fired based on a custom button click from Case record's detail page. window.location = 'apex/onClickPage?Id={!Case.Id}';
In Apex controller class, I am getting the Id from the URL using: String caseUrlId = ApexPages.currentPage().getParameters().get('Id');
Based on the URL, I am querying Case object to get some field that are to be displayed on the VF page.
If a user deletes the Id from the URL, I am getting a page with error message: common.apex.runtime.impl.ExecutionException: Attempt to de-reference a null object
.
How can I use Try-Catch blocks to handle this:
If Id from the URL is deleted, I need to redirect the user to the Standard Salesforce Home page.