Added fix for potential NPE when Restlet handles an exception.