Fix call to InstanceKlass::cast to only be after verifying class is non-null. Reviewed-by: dholmes, sspitsyn
Reviewed-by: darcy, ihse