Don't crash when startActivity() fails

Fixes issue 6201